diff --git a/apps/docs/scripts/compile-content.ts b/apps/docs/scripts/compile-content.ts index 3dea43fe2ac..9ae438350ca 100644 --- a/apps/docs/scripts/compile-content.ts +++ b/apps/docs/scripts/compile-content.ts @@ -24,6 +24,26 @@ const SYNTAX_THEME_FILE = path.resolve( DOCS_ROOT, '../../packages/emcn/src/components/code/syntax-theme.ts' ) +/** + * Files whose change can alter every page's output: their content keys the compile cache, and + * `--watch` rebuilds when any of them changes. + */ +const PIPELINE_FILES = [ + import.meta.filename, + path.join(DOCS_ROOT, 'lib/content/compile.ts'), + path.join(DOCS_ROOT, 'lib/content/markdown.ts'), + path.join(DOCS_ROOT, 'lib/content/output.ts'), + path.join(DOCS_ROOT, 'lib/shiki-theme.ts'), + SYNTAX_THEME_FILE, + path.join(DOCS_ROOT, 'components/workflow-preview/examples.ts'), + path.join(DOCS_ROOT, 'components/workflow-preview/block-display-workflows.ts'), + path.join(DOCS_ROOT, 'package.json'), + // Integration pages and their index expand catalog content and FAQs from these. + path.join(DOCS_ROOT, 'lib/integrations/seo.ts'), + path.join(DOCS_ROOT, 'lib/integrations/seo-overrides.ts'), + path.join(DOCS_ROOT, '../../packages/deployment-config/src/integrations.json'), + path.join(DOCS_ROOT, '../../packages/deployment-config/src/integration-totals.ts'), +] const CONTENT_ROOT = path.join(DOCS_ROOT, 'content/docs') const OUTPUT_ROOT = path.join(DOCS_ROOT, '.content') const MAX_CONTENT_BYTES = 64 * 1024 * 1024 @@ -197,24 +217,8 @@ function validateMedia(relative: string, mediaPaths: string[]) { async function generate() { await mkdir(path.join(OUTPUT_ROOT, 'pages'), { recursive: true }) - const pipelineFiles = [ - import.meta.filename, - path.join(DOCS_ROOT, 'lib/content/compile.ts'), - path.join(DOCS_ROOT, 'lib/content/markdown.ts'), - path.join(DOCS_ROOT, 'lib/content/output.ts'), - path.join(DOCS_ROOT, 'lib/shiki-theme.ts'), - SYNTAX_THEME_FILE, - path.join(DOCS_ROOT, 'components/workflow-preview/examples.ts'), - path.join(DOCS_ROOT, 'components/workflow-preview/block-display-workflows.ts'), - path.join(DOCS_ROOT, 'package.json'), - /** Integration pages and their index expand catalog content and FAQs from these. */ - path.join(DOCS_ROOT, 'lib/integrations/seo.ts'), - path.join(DOCS_ROOT, 'lib/integrations/seo-overrides.ts'), - path.join(DOCS_ROOT, '../../packages/deployment-config/src/integrations.json'), - path.join(DOCS_ROOT, '../../packages/deployment-config/src/integration-totals.ts'), - ] const pipelineHash = hash( - (await Promise.all(pipelineFiles.map((file) => readFile(file, 'utf8')))).join('\n') + (await Promise.all(PIPELINE_FILES.map((file) => readFile(file, 'utf8')))).join('\n') ) const previous = await readCache() const cache: CompiledCache = { pipeline: pipelineHash, files: {} } @@ -473,6 +477,8 @@ if (process.argv.includes('--watch')) { void refresh() }, 150) } + const pipelineFiles = new Set(PIPELINE_FILES) + const openApiSpecs = new Set(OPENAPI_SPEC_FILES) watch(DOCS_ROOT, { recursive: true }, (_, filename) => { const changed = filename?.toString().replaceAll('\\', '/') ?? '' if ( @@ -480,15 +486,21 @@ if (process.argv.includes('--watch')) { !changed.startsWith('lib/content/') && !changed.startsWith('lib/search/') && !changed.startsWith('components/workflow-preview/') && - !['scripts/compile-content.ts', 'lib/shiki-theme.ts', ...OPENAPI_SPEC_FILES].includes(changed) + !openApiSpecs.has(changed) && + !pipelineFiles.has(path.join(DOCS_ROOT, changed)) ) return scheduleRefresh() }) - /* Editors save by replacing the file, which ends a watch on the file itself; watch its folder. */ - watch(path.dirname(SYNTAX_THEME_FILE), (_, filename) => { - if (filename?.toString() === path.basename(SYNTAX_THEME_FILE)) scheduleRefresh() - }) + // Pipeline files outside the docs tree: editors save by replacing a file, which ends a watch on + // the file itself, so each one's folder is watched instead. + const outsideDocs = (folder: string) => path.relative(DOCS_ROOT, folder).startsWith('..') + for (const folder of new Set(PIPELINE_FILES.map((file) => path.dirname(file)))) { + if (!outsideDocs(folder)) continue + watch(folder, (_, filename) => { + if (filename && pipelineFiles.has(path.join(folder, filename.toString()))) scheduleRefresh() + }) + } logger.info('Watching documentation source') await refresh() } else await generate() diff --git a/apps/sim/app/_shell/consent/consent-banner.tsx b/apps/sim/app/_shell/consent/consent-banner.tsx index c3e047866a7..03b84f63a92 100644 --- a/apps/sim/app/_shell/consent/consent-banner.tsx +++ b/apps/sim/app/_shell/consent/consent-banner.tsx @@ -74,7 +74,12 @@ export function ConsentBanner() { Necessary cookies keep Sim working. Optional cookies help us understand usage, measure campaigns, and personalize ads on other sites. You can change or withdraw consent at any time in Privacy settings or through our{' '} - + Cookie Policy . diff --git a/apps/sim/lib/website/homepage.test.ts b/apps/sim/lib/website/homepage.test.ts index 0670579439e..dcd904682cd 100644 --- a/apps/sim/lib/website/homepage.test.ts +++ b/apps/sim/lib/website/homepage.test.ts @@ -92,11 +92,14 @@ describe('fetchWebsiteHomepage', () => { ['noindex', 'noindex'], ['noindex, nofollow', 'noindex, nofollow'], ['NoIndex,max-snippet:-1', 'noindex, max-snippet:-1'], - ['noindex, unavailable_after: 2027-01-01', null], - ['googlebot: noindex', null], + ['noindex, unavailable_after: 2027-01-01', 'noindex'], + ['googlebot: noindex', 'noindex'], + ['googlebot: none', 'noindex'], + ['index, unavailable_after: 2027-01-01', null], + ['max-image-preview:none, unavailable_after: 2027-01-01', null], ['noindex\nSet-Cookie: x=1', null], ])( - 'passes on the website indexing directives only when all are known: %j', + 'passes on the website indexing directives when all are known, and a noindex in any case: %j', async (tag, expected) => { const upstream = await startUpstream((response) => { response.writeHead(200, { diff --git a/apps/sim/lib/website/homepage.ts b/apps/sim/lib/website/homepage.ts index 94fa2228480..f715b233008 100644 --- a/apps/sim/lib/website/homepage.ts +++ b/apps/sim/lib/website/homepage.ts @@ -57,11 +57,11 @@ interface WebsiteHomepage { body: string /** The website's page policy; Markdown is not rendered as a page and carries none. */ contentSecurityPolicy: string | null - /** The website's indexing directives (`X-Robots-Tag`), when they are all known directives. */ + /** The website's indexing directives (`X-Robots-Tag`), when known, or `noindex` when it asked for one. */ robotsTag: string | null } -/** Indexing directives that may be passed on; anything else drops the whole header. */ +/** Indexing directives that may be passed on as written. */ const ROBOTS_DIRECTIVES = new Set([ 'all', 'index', @@ -76,9 +76,17 @@ const ROBOTS_DIRECTIVES = new Set([ ]) const ROBOTS_LIMIT_DIRECTIVE = /^max-(?:snippet|image-preview|video-preview):[a-z0-9-]+$/ +/** + * A `noindex` or `none`, alone or scoped to one crawler (`googlebot: noindex`); the value of a + * `max-*:` limit (`max-image-preview:none`) is not one. + */ +const NOINDEX_DIRECTIVE = /^(?:(?!max-)[\w-]+:\s*)?(?:noindex|none)$/ + /** * The website's `X-Robots-Tag` when every directive in it is a known one, so its indexing choice * (e.g. `noindex` on a non-indexable build) holds at `/` too without passing anything else on. + * A header with an unknown directive is not passed on, but a `noindex` in it still is, as a plain + * `noindex`: `/` can only end up stricter than the website asked, never more indexable. */ function readRobotsTag(value: string | null): string | null { if (!value) return null @@ -86,7 +94,8 @@ function readRobotsTag(value: string | null): string | null { const known = directives.every( (directive) => ROBOTS_DIRECTIVES.has(directive) || ROBOTS_LIMIT_DIRECTIVE.test(directive) ) - return known ? directives.join(', ') : null + if (known) return directives.join(', ') + return directives.some((directive) => NOINDEX_DIRECTIVE.test(directive)) ? 'noindex' : null } /**