Skip to content

SEO: add canonical URLs to every page #673

Description

@oalders

Problem

No page emits a <link rel="canonical">. The site is served at https://perladvent.org/ but internal links are all relative, and content is reachable under multiple hosts/paths (e.g. perladvent.org, the *.github.io Pages host, with/without trailing behaviors). Without a canonical URL, search engines can index duplicate host variants and split ranking signals.

Evidence

grep -ri 'rel="canonical"' out/ returns nothing. The <head> in inc/WWW-AdventCalendar/share/templates/page.mhtml (lines 3-15) contains no canonical link. Rendered out/2024/2024-12-01.html head (lines 3-15) confirms none is present. The atom feed already knows absolute URLs (out/2024/atom.xml uses https://perladvent.org/2024/2024-12-01.html), so the canonical base is well established.

Impact

  • Duplicate-content dilution across the apex domain and the GitHub Pages host.
  • Weaker consolidation of link equity to the intended URL.

Proposed fix (repo-side)

In script/seo-postprocess.pl, inject <link rel="canonical" href="https://perladvent.org/<output-path>"> into every out/**/*.html, using the canonical field already produced in out/seo-manifest.json by script/build-seo-manifest.pl (and the same absolute-URL convention for non-article pages like the year index and archives). No fork change required.

Acceptance criteria

  • Every generated HTML page has exactly one <link rel="canonical"> with an absolute https://perladvent.org/... URL matching its deployed path.
  • Article canonicals match the canonical value in out/seo-manifest.json.
  • Index, archive, and static pages also receive correct canonicals.

Filed as part of an SEO audit. Implementation is deferred (no work in the current branch).

Activity

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

    Site generationTasks which should maybe happen automaticlly

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions