Skip to content

Add support for canonical URLs #45

Open

Description

@bmorelli25

Summary

  • A writer should be able to config toc.yml so the top-most page of a bucket of pages is the canonical URL for all subpages. See @colleenmcginnis's LSR example below.
  • A writer should be able to explicitly define a page in a toc.yml as noindex.

Activity

  1. transferred this issue fromon Nov 11, 2024
  2. lcawl commented on Jul 3, 2025

    @lcawl
    Contributor

    This requirement will become more relevant as we get more sibling pages. As discussed in tech leads meeting today, it seems likely that we'll have sibling pages for some automated reference content (e.g. Beats configuration details) and want to have the option to de-prioritize the older sibling pages from an SEO point of view.

  3. colleenmcginnis commented on Jul 11, 2025

    @colleenmcginnis
    Contributor

    This would also be helpful for Logstash versioned plugin docs.

  4. KOTungseth commented on Jul 14, 2025

    @KOTungseth
    Contributor

    What Docs system is this for?

    If this issue applies to only /guide, setting canonical tags on every page will send the signal that we do not want users and search engines to find the 8.latest and earlier versions of docs. Only the 9.0.0 and later docs.

    The SEO metadata shows the version number for 8.latest and earlier, as well as the content structure & hierarchy, which gives the signal that the 8.latest and earlier pages apply to a different version than current. Also, the 8.latest /guide URLs are properly redirecting to the latest /docs pages.

    Two questions:

    • Is the goal of this issue to make sure that 8.latest /guide URLs canonicalize to the latest /docs URLs? This already happens on /docs pages.
    • Should we canonicalize /guide pages?
  5. colleenmcginnis commented on Jul 14, 2025

    @colleenmcginnis
    Contributor

    I was assuming this was just for docs-builder since it's in this repo. 🙂

    Here's an example of where I would like to be able to use this in the Logstash versioned plugins docs where aws is the lastest version of the plugin and the versions below are previous versions. When we were building these docs with AsciiDoc, we added noindex to all the older versions. We don't (as far as I know) have the ability to prevent indexing on specific pages in docs-builder without also hiding them from the toc. I would be fine with either marking the pages as noindex or pointing to a canonical URL.

    Image
  6. bmorelli25 commented on Jul 14, 2025

    @bmorelli25
    MemberAuthor

    @KOTungseth This issue was scoped before we did away with the idea of current. I'll update the issue description so it matches the needs described by @lcawl , @colleenmcginnis , and (soon!) @georgewallace.

  7. georgewallace commented on Jul 15, 2025

    @georgewallace
    Contributor

    For our API docs we want to have all versions available to our customers. For Kibana and Elasticsearch this means v8, v9, and main. We want only our v9 for those specifications to be available to google search, but we want within our internal site search to be able to find all the versions. This causes issues as we can't remove v8 or main from the sitemap or else we would lose them in the site search.

  8. cotti commented on May 26, 2026

    @cotti
    Contributor

    Codebase audit (2026-05-26)

    Doing a sweep of the oldest open issues and checking whether they're still actionable. Sharing what I found here.

    Current state in docs-builder

    Canonical URLs

    Feature Status Where
    Site-level CanonicalBaseUrl + per-page self URL → <link rel="canonical"> ✅ Implemented src/Elastic.Documentation.Site/Layout/_Head.cshtml + _ViewModels.cs::CanonicalUrl
    Production assembler hard-codes https://www.elastic.co ✅ Implemented AssemblerDocumentationSet.cs:79 ("Always use the production URL. In case a page is leaked to a search engine, it should point to the production site.")
    Per-page frontmatter canonical: override ❌ Not implemented No canonical field in FrontMatterParser.cs
    TOC-parent canonical (parent page = canonical for children — the main ask) ❌ Not implemented —
    Sibling-page / versioned-content deprioritization ❌ Not implemented —

    noindex / robots

    Mechanism Effect
    Frontmatter noindex: true ✅ Robots meta only — does not exclude from sitemap or ES index
    toc.yml hidden: ✅ Robots meta + excluded from sitemap + excluded from ES (search) — but also hidden from navigation
    assembler.yml env allow_indexing ✅ Site-wide
    Standalone noindex: key in toc.yml (visible in nav, but noindex) ❌ Not implemented
    Documented SiteNavigationNoIndexFile type (in docs/development/navigation/node-types.md) ⚠️ Documented but not implemented in src/

    Sitemap

    • All /docs/api/* URLs are stripped from sitemap.xml (see SitemapBuilder.cs:33 — explicit // TODO: Remove this exclusion when API docs are ready for sitemap inclusion).
    • This is a blanket strip, not per-version — which means georgewallace's ask ("v9 in Google sitemap but v8 + main only in site search") is not satisfied by the current behavior.

    Mapping back to the updated issue description

    AC Status
    Writer can configure toc.yml so the top-most page = canonical for all subpages ❌
    Writer can explicitly define a page in toc.yml as noindex (without hiding from nav) ❌ (closest is hidden:, which also removes from nav)

    So neither AC is met as written. Both are clean, scoped additions.

    Lingering questions

    1. Per-page frontmatter canonical: — should this take precedence over a TOC-parent canonical, or vice versa? Recommend frontmatter wins (more specific), but worth confirming with the docs SEO owner.
    2. Sibling pages canonical semantics — for Logstash-versioned plugin docs (colleenmcginnis's example) and Beats config sibling pages (lcawl): do older siblings get <link rel="canonical"> pointing to the latest, or just noindex? Google's guidance differs depending on intent (consolidate vs. exclude).
    3. API docs sitemap — should sitemap.xml include only the latest API version (v9), or none of /docs/api/* (current behavior)? Does this match the API docs team's expectation?
    4. Frontmatter noindex: true and search/sitemap — today this only affects robots meta. Should it also exclude from sitemap.xml and from the ES index used by site search? I'd argue yes (an author marking a page noindex almost certainly means "don't surface this in any discovery surface"), but it's a behavior change worth confirming.
    5. The orphaned SiteNavigationNoIndexFile doc — docs/development/navigation/node-types.md describes a type that doesn't exist in src/. Either implement it or remove the doc page; either way, this is a small chore.

    Suggested implementation order (small slices)

    1. Per-page frontmatter canonical: (one field, one Razor change, one snapshot test).
    2. toc.yml canonical_parent: true on a folder/bucket.
    3. Frontmatter noindex: true honored in sitemap + ES index.
    4. Replace blanket /docs/api/ sitemap strip with versioned filter (pending Q3 answer).
  9. added
    ai-triaged
    on May 26, 2026
  10. github-actions commented on Aug 30, 2026

    @github-actions
    Contributor

    This issue is stale because it has been open 90 days with no activity. Remove the stale label, or leave a comment, or this will be closed in 14 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SEOai-triaged

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions