Skip to content
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

Link to taxonomy lists fails with custom permalinks #4130

Closed
madeso opened this issue Nov 27, 2017 · 7 comments
Closed

Link to taxonomy lists fails with custom permalinks #4130

madeso opened this issue Nov 27, 2017 · 7 comments

Comments

@madeso
Copy link

madeso commented Nov 27, 2017

The links in the samples expects the taxonomy list to be at the default location:
https://gohugo.io/templates/taxonomy-templates/#order-taxonomies
but that will fail with a custom permalink introduced in v0.31 since the page is probably not rendered at /PLURAL/TERM/.

The only workaround I've found is to create a per-term page for the custom link instead of the general _default/terms.html template.

@bep
Copy link
Member

bep commented Nov 27, 2017

I think this is a documentation issue. It should be possible to do this without "manual URL construction".

@rdwatters are those your examples?

I'll keep this open for now -- in case this isn't currently possible, we should make it.

@stale
Copy link

stale bot commented Feb 25, 2018

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.

@stale stale bot added the Stale label Feb 25, 2018
@stale stale bot closed this as completed Mar 12, 2018
@shaform
Copy link

shaform commented Jul 13, 2018

I am interested in knowing how to support custom permalinks of taxonomy in templates as well. Is it possible to do this now? How?

@vassudanagunta
Copy link
Contributor

If PR #4796 is merged, then you won't need to hardcode anymore. You could use

{{% relref "tags" %}}

which would be resolved to whatever url tags is published to. Likewise a call to .GetPage "tags" would return you the page object, from which you could query its actual URL, title or whatever.

I already take advantage of this in my fork of Hugo.

@vassudanagunta
Copy link
Contributor

@bep I think this issue should be re-opened.

@shaform
Copy link

shaform commented Jul 17, 2018

It looks like we could use:

{{ with $.Site.GetPage "taxonomy" $type $termName }}

Perhaps I should submit a PR to modify the document? Currently it says:

 <li><a href="{{ $.Site.LanguagePrefix }}/{{ $data.Plural }}/{{ $value.Name | urlize }}"> {{ $value.Name }} </a> {{ $value.Count }} </li>

, which certainly still fails with custom permalinks.

@github-actions
Copy link

github-actions bot commented Mar 1, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants