cotes2020 / jekyll-theme-chirpy

A minimal, responsive, and feature-rich Jekyll theme for technical writing.
https://chirpy.cotes.page
MIT License
7.18k stars 5.66k forks source link

Missing leading slash from tag and category links #1827

Closed LeMikaelF closed 2 months ago

LeMikaelF commented 2 months ago

Checklist

How did you create the site?

Generated from chirpy-starter

Describe the bug

Adding a tag or a category a post generates links without a leading slash, leading to this error (reproducer repo):

* At _site/chirpy-test-bug/posts/reproducer/index.html:1:
  internally linking to chirpy-test-bug/categories/category1/, which does not exist
* At _site/chirpy-test-bug/posts/reproducer/index.html:1:
  internally linking to chirpy-test-bug/tags/tag1/, which does not exist
* At _site/chirpy-test-bug/posts/reproducer/index.html:1:
  internally linking to chirpy-test-bug/tags/tag2/, which does not exist

I'm able to reproduce the issue locally and solve it by adding a leading slash to the links in_layouts/post.html at lines 108 and 120 (in jekyll-theme-chirpy), however I am not so familiar with ruby or jekyll, and I see that this code has been there for a while and that there also are other uses of {{ site.baseurl }} without a leading slash, so I am not sure if that's the right fix.

This looks like a great theme, contratulations for this. I'd really like to get it working, so thanks in advance for the help.

Steps To Reproduce

  1. Clone the template (https://github.com/cotes2020/chirpy-starter/generate)
  2. Set the url and baseurl (https://github.com/LeMikaelF/chirpy-test-bug/commit/4ce9defd38c1124ffe711ad8dc3051433d9735a4)
  3. Add a post with tags and categories (https://github.com/LeMikaelF/chirpy-test-bug/commit/c4dc2a86c5a0ac8e90b9b9cd6b028c098f05315f)
  4. Pipeline fails with a html lint error

Expected Behavior

No error

Environment

Locally:

Also happens on CI with the vanilla chirpy-starter template

Anything else?

No response

cotes2020 commented 2 months ago

Your url and baseurl are both wrong.

LeMikaelF commented 2 months ago

that was it, thank you.