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

Taxonomy terms with single quote in the term name and custom metadata duplicates #12606

Closed
nikdoof opened this issue Jun 18, 2024 · 4 comments
Closed

Comments

@nikdoof
Copy link

nikdoof commented Jun 18, 2024

Please excuse the title, as I can't think of a better way to explain this issue in a single line.

On my site, I have a specific taxonomy that has single quotes in the term name, e.g. "Disney's Riviera Resort". If I define custom metadata/content for this term then the customised version will render, but also a non-customised version linking to the same pageRef.

Removing the custom metadata returns the term to a 'working' state.

Steps to Reproduce

  1. Create a new site with a default theme
  2. Create a taxonomy in hugo.toml
  3. Create a page using that taxonomy, with a tag with a "'" in it (e.g. Disney's, which is urlized to "disneys")
  4. Check taxonomy/disneys page and see it rendering correctly
  5. Create a custom metadata taxonomy/disneys/_index.md with a title the same as the current name, add content or metadata
  6. Check taxonomy/tag page and see multiple entries have rendered.

What version of Hugo are you using (hugo version)?

$ Hugo version
hugo v0.127.0-74e0f3bd63c51f3c7a0f07a7c779eec9e922957e+extended darwin/arm64 BuildDate=2024-06-05T10:27:59Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes

@nikdoof
Copy link
Author

nikdoof commented Jun 18, 2024

Possibly related to #12191, The suggested workaround in this issue of using the term without " or ' and then override the title within the metadata does seem to work, but changes of the title/metadata do not seem to be detected correctly during hugo serve and result in dead/duplicate pages being rendered, restarting hugo serve resolves it.

Here is a demo repo for the issue: https://github.com/nikdoof/hugo-12606

@jmooring
Copy link
Member

jmooring commented Jun 18, 2024

I have not yet dug into the details above, but I wrote this tips & tricks post a few months ago, prompted by the release of v0.123.0:

https://discourse.gohugo.io/t/limit-use-of-punctuation-within-taxonomy-terms/48638

There's an open issue to add this information to the documentation:
gohugoio/hugoDocs#2465

@jmooring
Copy link
Member

I created a minimal example per your description above:

git clone --single-branch -b hugo-github-issue-12606 https://github.com/jmooring/hugo-testing hugo-github-issue-12606
cd hugo-github-issue-12606
hugo --printPathWarnings

The terminal displays this warning...

WARN Duplicate target paths: /tags/disneys-riviera-resort/index.html (2)

...which is expected per the tips & tricks post that I referred to in my previous comment.

To handle this correctly:

content/posts/post-1.md
+++
title = 'Post 1'
tags = ["Disneys Riviera Resort"]   # disallowed punctuation removed
+++
content/tags/disneys-riviera-resort/_index.md
+++
title = "Disney's Riviera Resort"  # add punctuation as needed
+++

@jmooring
Copy link
Member

@nikdoof I'm going to close this. The documentation update will be addressed in gohugoio/hugoDocs#2465.

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

No branches or pull requests

2 participants