-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tags containing '#' produce invalid links #197
Comments
In fact, the problem is also in posts, but slightly different.
I think |
The problem is also on the tag page: the link to the next page is broken, for the same reason. Not sure how to fix this one, though... I don't really know how the paginator works. |
Upstream bug (limitation). As far as I remember, special characters are still an unresolved thing for Hugo taxonomies (tags, categories, ...). All related examples/functions in the Hugo documentation do not handle such cases (with special URI/URL characters). Or they can handle this case, but break anything else. All other options like "use replace" are suitable for a specific site, but not for the theme, I think. |
Yeah, I agree this should be properly handled by Hugo itself, it shouldn't be the theme's responsibility. I guess Hugo should just expose the URL of the tag page Anyway, the |
Technically, the same way.
{{- if or (.Paginator.HasPrev) (.Paginator.HasNext) }}
<div class="pagination">
{{- if .Paginator.HasPrev }}
<a class="pagination__item pagination__item--prev btn" href="{{ replace .Paginator.Prev.URL "#" "%23" }}">«</a>
{{- end }}
<span class="pagination__item pagination__item--current">
{{- .Paginator.PageNumber }}/{{ .Paginator.TotalPages -}}
</span>
{{- if .Paginator.HasNext }}
<a class="pagination__item pagination__item--next btn" href="{{ replace .Paginator.Next.URL "#" "%23" }}">»</a>
{{- end }}
</div>
{{- end }} Not tested. |
@Vimux thanks! Closing, since the issue is in Hugo, not in the theme. Great work on this theme, by the way, I love it! Great level of customization. |
Thank you, but I re-opened this issue. I think other people may face the same problem. |
For instance, the tag
C#
produces the URL/tags/c#/
, which yields a 404. The correct URL is/tags/c%23/
.The problem only exists in the widget, not on the posts themselves.Scratch that, actually it's also on the posts, but the problem is different. See next message for detailsRelated to this thread: https://discourse.gohugo.io/t/special-characters-in-tags/6410/4
The text was updated successfully, but these errors were encountered: