fix: tags url with integers
The issue: Using integer as tags (e.g. 2025) is supported by hugo, but printf here converts it to `sint2025`.
An easy client-side solution would be to add quotes to the tag `"2025"`, but it's not intuitive.
Instead, we let hugo choose how to do the conversion.
Working tags:
- `NoSpace` => `tags/nospace/`
- `Two Words` => `tags/two-words/`
- `2025` => `tags/2025/`
- `2025.1` => `tags/2025.1/`
- `1/2` => `tags/1/2/`
- `✔️` => `tags/%EF%B8%8F/`
Breaking change:
- `1\2` => `tags/1/2` but was and should be `tags/1\2` (or `tags/1%5C2`)
IMO we can ignore this case, which can produce other weird behaviours
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
{{ if .Params.tags }}
|
||||
<span class="post-tags">
|
||||
{{ range .Params.tags }}
|
||||
#<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
|
||||
#<a href="{{ (urls.JoinPath "tags" (urlize .)) | absLangURL }}">
|
||||
{{- . -}}
|
||||
</a>
|
||||
{{ end }}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
{{ if .Params.tags }}
|
||||
<span class="post-tags">
|
||||
{{ range .Params.tags }}
|
||||
#<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
|
||||
#<a href="{{ (urls.JoinPath "tags" (urlize .)) | absLangURL }}">
|
||||
{{- . -}}
|
||||
</a>
|
||||
{{ end }}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
{{ if .Params.tags }}
|
||||
<span class="post-tags">
|
||||
{{ range .Params.tags }}
|
||||
#<a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">{{ . }}</a>
|
||||
#<a href="{{ (urls.JoinPath "tags" (urlize .)) | absLangURL }}">{{ . }}</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
{{ if .Params.tags }}
|
||||
<span class="post-tags">
|
||||
{{ range .Params.tags }}
|
||||
#<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
|
||||
#<a href="{{ (urls.JoinPath "tags" (urlize .)) | absLangURL }}">
|
||||
{{- . -}}
|
||||
</a>
|
||||
{{ end }}
|
||||
|
||||
@@ -63,7 +63,7 @@ HERE INSERT ANY CUSTOM <script/> or <style/>
|
||||
{{ if .Params.tags }}
|
||||
<span class="post-tags">
|
||||
{{ range .Params.tags }}
|
||||
#<a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">{{ . }}</a>
|
||||
#<a href="{{ (urls.JoinPath "tags" (urlize .)) | absLangURL }}">{{ . }}</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user