Skip to content

Fix tag links for terms with special characters (e.g. C#) - #262

Open
markheydon wants to merge 1 commit into
gurusabarish:masterfrom
markheydon:fix/tag-links-special-chars
Open

Fix tag links for terms with special characters (e.g. C#)#262
markheydon wants to merge 1 commit into
gurusabarish:masterfrom
markheydon:fix/tag-links-special-chars

Conversation

@markheydon

Copy link
Copy Markdown

Summary

  • Single-page tag links were built with urlize on the raw tag string, which strips # (and mishandles similar characters), so C# linked to /tags/c and 404'd.
  • Switch the tags sidebar in layouts/_default/single.html to .GetTerms "tags" + .RelPermalink + .LinkTitle so links match Hugo’s generated taxonomy term pages (e.g. /tags/c%23/).
  • Preserves existing markup/classes and keeps openInNewTab default as true.

Fixes #261

Test plan

  • Add a post/project with tags: ["C#"]
  • Build/serve the site
  • On the single page, click the C# tag link and confirm it goes to /tags/c%23/ (not /tags/c)
  • Confirm other ordinary tags still link correctly
  • Confirm tags still open in a new tab by default

Made with Cursor

Use GetTerms + RelPermalink instead of urlize so taxonomy links match Hugo term pages.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

Tag links for C# (and similar terms) 404 because urlize strips #

1 participant