From a02446aad8fd6e732de43f9642d377438876c086 Mon Sep 17 00:00:00 2001 From: Samuel Berthe Date: Tue, 21 Apr 2026 17:46:18 +0200 Subject: [PATCH] fix(seo): sync meta tags, robots.txt and sitemap config from samber/do - Add twitter:site, og:locale, og:site_name head tags - Add fallback description meta tag - Exclude /search from sitemap - Disallow /search and /tags/ in robots.txt --- docs/docusaurus.config.ts | 38 ++++++++++++++++++++++++++++++++++---- docs/static/robots.txt | 4 ++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index 309d6e1..b160100 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -135,9 +135,35 @@ const config: Config = { content: '@samuelberthe', }, }, - // NOTE: do not add a global here. - // Docusaurus generates correct per-page canonical tags from the `url` field above. - // A global canonical in headTags applies to ALL pages and conflicts with those. + // twitter:site complements twitter:creator for card attribution + { + tagName: 'meta', + attributes: { + name: 'twitter:site', + content: '@samuelberthe', + }, + }, + // og:locale signals language/region to crawlers and social platforms + { + tagName: 'meta', + attributes: { + property: 'og:locale', + content: 'en_US', + }, + }, + // og:site_name provides branding context in social share cards + { + tagName: 'meta', + attributes: { + property: 'og:site_name', + content: 'samber/lo', + }, + }, + // NOTE: do NOT add a global here. + // Docusaurus injects a correct per-page canonical automatically + // based on `url` + `baseUrl` + the page path. A static href here + // would override every page's canonical to the homepage, causing + // Google to treat all docs pages as non-canonical duplicates. ], customFields: { @@ -181,7 +207,7 @@ const config: Config = { lastmod: 'date', changefreq: 'weekly', priority: 0.7, - ignorePatterns: ['/tags/**'], + ignorePatterns: ['/tags/**', '/search'], filename: 'sitemap.xml', // Enhanced sitemap features from 3.8+ createSitemapItems: async (params) => { @@ -228,8 +254,12 @@ const config: Config = { }, // Enhanced metadata + // og:type defaults to "website"; individual doc pages that need + // "article" should override via their page's or frontmatter. metadata: [ {name: 'og:type', content: 'website'}, + // Fallback description for pages that don't set their own + {name: 'description', content: 'A Lodash-style utility library for Go. Slices, maps, channels, and more — type-safe, using generics.'}, ], navbar: { diff --git a/docs/static/robots.txt b/docs/static/robots.txt index 91432bd..0e91752 100644 --- a/docs/static/robots.txt +++ b/docs/static/robots.txt @@ -1,4 +1,8 @@ User-agent: * Allow: / +# Low-value pages — no need to crawl or index +Disallow: /search +Disallow: /tags/ + Sitemap: https://lo.samber.dev/sitemap.xml