FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

add canonical link tags for all pages by ritorhymes · Pull Request #28 · gitgitgadget/gitgitgadget.github.io · GitHub

add canonical link tags for all pages - #28

Merged
dscho merged 1 commit into
gitgitgadget:mainfrom
ritovision:url
Feb 25, 2026
Merged

add canonical link tags for all pages#28
dscho merged 1 commit into
gitgitgadget:mainfrom
ritovision:url

Conversation

ritorhymes commented Feb 22, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Add canonical link tags in the base template.

Use .Permalink as the source and strip a trailing .html suffix so canonical URLs are extensionless (e.g. /architecture).

Prefer extensionless canonical URLs because they are shorter and cleaner, while the .html variants remain valid and accessible on GitHub Pages.

Canonical tags tell search engines which URL is authoritative, reducing duplicate-URL ambiguity for indexing and ranking.

dscho commented Feb 23, 2026

Copy link
Copy Markdown
Member

Is this backwards-compatible? I.e. would existing ugly links still work?

ritorhymes commented Feb 23, 2026
edited
Loading

Copy link
Copy Markdown
Contributor Author

Not currently no. Do you want them to still work? I actually didn't realize until now that prettyURLs worked fine with uglyURLs enabled and both rendered the same pages identically (at least with GitHub pages). Knowing that, I could revert disabling uglyURLs and just focus on making the canonical links on both versions point to the prettyURL version. I'd actually recommend that approach instead, no reason to burn the uglyURLs and throw off backwards-compatibility if prettyURLs work fine already, idk why I thought they didn't before.

What do you want to do?

Add canonical link tags in the base template.

Use .Permalink as the source and strip a trailing .html suffix so
canonical URLs are extensionless (e.g. /architecture).

Prefer extensionless canonical URLs because they are shorter and cleaner,
while the .html variants remain valid and accessible on GitHub Pages.

Canonical tags tell search engines which URL is authoritative, reducing
duplicate-URL ambiguity for indexing and ranking.
ritorhymes changed the title switch to pretty URLs and add canonical link tags add canonical link tags for all pages Feb 25, 2026

Copy link
Copy Markdown
Contributor Author

I see now.

When uglyURLs is enabled, the .html and extensionless path equivalent (magically) work identically without specifically configuring it only on GitHub Pages for this Hugo environment (unless you are doing something idk about). Otherwise, extensionless pages are broken locally and they break when I deploy on Vercel for my demo site.

Knowing that's how the infra here works and that both path types will succeed, I left the URL structure alone and just added canonical tags for the extensionless version since it's shorter and smoother to read.

dscho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thank you!

dscho merged commit 70f6cc9 into gitgitgadget:main Feb 25, 2026
1 check passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL