Skip to content

Commit 79b389e

Browse files
jorgembfigueiragsmet
authored andcommitted
Strip commas from tag values when building blog tag links
Some posts declare tags using a comma-separated list (e.g. `tags: ai, mcp, agent`) instead of the space-separated form. The Liquid template in `_layouts/post.html` then rendered links like `/blog/tag/ai,` which return a 404. Strip commas from both the URL and the displayed tag so the links work regardless of the separator style used in front matter.
1 parent 73d2275 commit 79b389e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

_layouts/post.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<div class="post-date">
1616
{{ page.date | date: '%B %d, %Y' }}
1717
{% if page.tags %}
18-
<span class="tags">{% for tag in page.tags %}<a href="{{site.baseurl}}/blog/tag/{{ tag | downcase | replace: '.', '-' }}">#{{ tag | downcase }}</a>{% endfor %}</span>
18+
<span class="tags">{% for tag in page.tags %}<a href="{{site.baseurl}}/blog/tag/{{ tag | downcase | replace: ',', '' | replace: '.', '-' }}">#{{ tag | downcase | replace: ',', '' }}</a>{% endfor %}</span>
1919
{% endif %}
2020
</div>
2121
<h1 class="post-title">{{ page.title }}</h1>

0 commit comments

Comments
 (0)