Closed Vimux closed 4 years ago
My temporary workaround is to use urls.Parse
to decode URLs, then you can get the page...
{{ $taxo := "tags" }}
<ul id="{{ $taxo }}">
{{ range .Param $taxo }}
{{ $name := . }}
{{ $url := urls.Parse ($name | urlize) }}
{{ $path := $url.Path }}
{{ with $.Site.GetPage (printf "/%s/%s" $taxo $path) }}
<li><a href="{{ .Permalink }}">{{ $name }}</a></li>
{{ end }}
{{ end }}
</ul>
BTW, you won't have this problem if you use .Site.Taxonomies.tags
or .Data.Terms
...
See also:
@reuixiy,
Thank you. Good suggestion. I think about anchorize as an urlize replacement in this particular case. I'm still not sure that this will work for all possible cases.
BTW, you won't have this problem if you use
.Site.Taxonomies.tags
or.Data.Terms
...
And this is the main reason why I created the issue here. I'm not a hundred percent sure that this is just Docs problem and I want to get some clarification about this. However, it doesn't negate the fact that Hugo Docs contains mislead section about very popular thing right now.
It seems I'm not the only one who thought about this:
https://github.com/gohugoio/hugoDocs/commit/7cff379f58168066073044d5a4488cc589815ae8#r33705430
Also note that anchorize
is different from urlize
, e.g.
foo(bar) | anchorize -> foo-bar
foo(bar) | urlize -> foobar
Duplicate of #5687?
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master
branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Briefly
Tag list (or any other taxonomy list) in a single page don't show some page tags because of urlized characters.
What version of Hugo are you using (
hugo version
)?Other tested versions:
Reproduction steps
Actual results:
Empty tag list.
Expected results:
Tag list with a clickable tag.
Additional notes:
This is happens because .GetPage function assume to get string like:
But, because of
urlize
, we have string like:I have two concerns about this:
anchorize
instead ofurlize
could solve this problem for all predicted use cases or not? It works, but maybe this can cause some potential side effects?I don't know it's a .GetPage or Hugo Docs problem, anyway, this needs some action or clarification.