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

Tag URL in single page does not match overridden permalink format #322

Open
madd0 opened this issue Apr 17, 2023 · 2 comments
Open

Tag URL in single page does not match overridden permalink format #322

madd0 opened this issue Apr 17, 2023 · 2 comments

Comments

@madd0
Copy link

madd0 commented Apr 17, 2023

I'm migrating an existing website to Hugo and using this theme. Everything is going great, but I found what appears to be a bug in the generation of tag links in single pages.

To prevent dead links, I have customized my tag and category URLs:

[permalinks]
  tags = '/tag/:title/'
  categories = '/category/:title/'

Although category links are generated correctly, and tag links are generated correctly in the sidebar, links under individual posts are not generated according to the configuration.

I looked at the sources and it appears that the issue stems from the post_tags.html:

<a class="tags__link btn" href="{{ "tags/" | relLangURL }}{{ . | urlize }}/" rel="tag">

I'm not very familiar with the Hugo programming syntax, but it looks to me like the URL is built using the hard-coded tags path instead of using the permalink built by Hugo, which is apparently what is done for categories:

{{- with $.Site.GetPage (printf "/%s/%s" $taxo $path) }}
	{{- if gt $index 0 }}, {{ end -}}
	<a class="meta__link" href="{{ .RelPermalink }}" rel="category">{{ .Title }}</a>
{{- end }}
@madd0
Copy link
Author

madd0 commented Apr 17, 2023

I'll try to fix this by basing myself on the category code and submit a PR as soon as I can.

@Vimux
Copy link
Owner

Vimux commented Apr 18, 2023

...it looks to me like the URL is built using the hard-coded tags path instead of using the permalink built by Hugo, which is apparently what is done for categories

I think there was a reason for that. 🤔

Sorry, my head is full of other things and I have no time to check it now, but If you plan to do PR, please read the contributing guidelines and test everything carefully.

To prevent dead links, I have customized my tag and category URLs:

Not sure if this changes the /tags/ page itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants