diff --git a/.changeset/pink-turtles-switch.md b/.changeset/pink-turtles-switch.md new file mode 100644 index 0000000000..50c7a53ec0 --- /dev/null +++ b/.changeset/pink-turtles-switch.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Fix order in robots.txt preventing indexation of images by Google. diff --git a/packages/gitbook/src/routes/robots.ts b/packages/gitbook/src/routes/robots.ts index 05fd7fb021..480042b5d2 100644 --- a/packages/gitbook/src/routes/robots.ts +++ b/packages/gitbook/src/routes/robots.ts @@ -13,11 +13,11 @@ export async function serveRobotsTxt(context: GitBookSiteContext) { const lines = isIndexable ? [ 'User-agent: *', + // Disallow other dynamic routes / search queries + 'Disallow: /*?', // Allow image resizing and icon generation routes for favicons and search results 'Allow: /~gitbook/image?*', 'Allow: /~gitbook/icon?*', - // Disallow other dynamic routes / search queries - 'Disallow: /*?', 'Allow: /', `Sitemap: ${linker.toAbsoluteURL(linker.toPathInSpace(isRoot ? '/sitemap.xml' : '/sitemap-pages.xml'))}`, ]