Skip to content

Fix tag links 404 by applying baseurl (Fixes #100) - #102

Merged
ultimatecoder merged 1 commit into
masterfrom
fix/tag-links-404-master
Aug 1, 2026
Merged

Fix tag links 404 by applying baseurl (Fixes #100)#102
ultimatecoder merged 1 commit into
masterfrom
fix/tag-links-404-master

Conversation

@ultimatecoder

Copy link
Copy Markdown
Owner

Problem

Clicking any tag from the Tags page returns a 404 (issue #100).

The site is a GitHub Pages project site with baseurl: "/Blog". The custom plugin _plugins/tag_gen.rb correctly generates each tag page at /Blog/tags/<tag>/index.html, but the links to those pages were hardcoded absolute as /tags/<tag>/, dropping the /Blog prefix. The browser then requested ultimatecoder.github.io/tags/<tag>/ (404) instead of the real page at .../Blog/tags/<tag>/.

Fix

Route the links through the Jekyll relative_url filter, which prepends site.baseurl — matching the pattern already used for post.url | relative_url in tag_index.html.

  • _layouts/tags_folder_index.html — tag list link
  • _layouts/tag_index.html — per-tag RSS subscribe link

No plugin changes needed; page generation was already correct. As a bonus, relative_url URL-encodes tags containing spaces.

Verification

Rebuilt locally (bundle exec jekyll build):

  • Tag links now render /Blog/tags/<tag>/ (e.g. /Blog/tags/How-to/, /Blog/tags/Ubuntu/)
  • RSS link now renders /Blog/tags/<tag>/feed.xml

Targets master so the Pages deploy workflow (.github/workflows/pages.yml, triggered on push to master) publishes the fix.

Fixes #100

🤖 Generated with Claude Code

Tag links were hardcoded as /tags/<tag>/ and the per-tag RSS link as
/tags/<tag>/feed.xml, omitting the site baseurl (/Blog). On the GitHub
Pages project site this resolved to ultimatecoder.github.io/tags/<tag>/
(404) instead of the generated page at .../Blog/tags/<tag>/.

Route both through the relative_url filter so site.baseurl is prepended,
matching the pattern already used for post.url in tag_index.html. This
also URL-encodes tags containing spaces.

Fixes #100

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ultimatecoder
ultimatecoder merged commit 719bffb into master Aug 1, 2026
1 check passed
ultimatecoder added a commit that referenced this pull request Aug 1, 2026
The site has been served as a GitHub Pages project site at
ultimatecoder.github.io/Blog/, which forced a "/Blog" baseurl through
_config.yml and scripts/test. That prefix already caused one production
bug (#100, tag links 404) and still breaks the root-absolute favicon and
apple-touch-icon paths in _includes/head.html, which resolve against the
domain root rather than /Blog/.

Point the site at blog.jaysinh.dev instead. The custom domain serves from
the domain root, so baseurl becomes empty:

* CNAME (new) tells GitHub Pages which domain to attach. The deploy is
  artifact-based (actions/deploy-pages), and Jekyll copies unknown root
  files into _site/, so the artifact carries it.
* _config.yml drops the "/Blog" baseurl.
* _config_production.yml points url at the new host, which feeds
  jekyll-seo-tag canonicals and the jekyll-sitemap output.
* scripts/test no longer needs --swap-urls "^/Blog:" — with an empty
  baseurl, _site/ on disk already matches the served paths. The 73
  internal links now pass unrewritten, which is what proves the change
  is internally consistent.

Tag links need no change: #102 routed them through relative_url, so they
pick up the empty baseurl and render as /tags/<tag>/ automatically.
Posts referencing {{ site.url }}{{ site.baseurl }}/assets/... resolve
correctly for the same reason.

Also ignore www.gweca.ac.in in the link checker. It returns 200 to curl
over both HTTP and HTTPS but 415 to htmlproofer — the same bot/WAF
blocking already recorded as "ci-block" for other hosts. Unrelated to
this change, but it fails CI.

Co-authored-by: Jaysinh Shukla <jaysinhshukla@Jaysinhs-MacBook-Pro-2.local>
Co-authored-by: Claude Opus 5 <noreply@anthropic.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.

Posts from tags are giving 404

1 participant