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

Special character in URL has new behaviour since 0.123.0 #12241

Closed
jmichelgarcia opened this issue Mar 13, 2024 · 10 comments
Closed

Special character in URL has new behaviour since 0.123.0 #12241

jmichelgarcia opened this issue Mar 13, 2024 · 10 comments

Comments

@jmichelgarcia
Copy link

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

latest (123.8)

When did the problem appear?

0.123.0

Problem

I am using Docsy and I have a file:

  • content/en/docs/Administration/On-Premises Deployments/Architecture & System Requirements/_index.md

FontMatter wise:

---
linkTitle: "Architecture & System Requirements"
title: "Architecture & System Requirements"
weight: "10"
aliases:
  - /en/architecture---system-requirements.html
description: "xxx"
---

Until 0.122.0 that page was being rendered with this url:

  • https://[domain]/en/docs/administration/on-premises-deployments/architecture-system-requirements/

After upgrading to 0.123.0, it is now being rendered as:

  • https://[domain]/en/docs/administration/on-premises-deployments/architecture--system-requirements/

notice the -- instead of -.

Is this expected?

I'm going through the release notes and code, to see if I missed anything.
Many thanks!

@jmooring
Copy link
Member

Reported here as well:
https://discourse.gohugo.io/t/hugo-v0-123-seems-to-anchorize-terms-in-their-urls-rather-than-urlize-them/48583

I know we made a "hyphen retention" change to address another issue (I think to retain three consecutive hyphens), but I'm not sure if the above is intentional.

@jmichelgarcia
Copy link
Author

@bep, is the above here to stay (and therefore I should change my aliases, links and so on), or if this is an unexpected behaviour? Thanks.

@jmichelgarcia
Copy link
Author

I believe this is the culprit (which I'm assuming is an intentional decision)

wasHyphen = r == '-'

@jmooring
Copy link
Member

jmooring commented Mar 13, 2024

Of a very small sampling (n=219) of sites in the wild running v0.100.0 or later, 23% are already running v0.123.0 or later, so... even if this wasn't intentional, changing it again may be unwise.

@jmichelgarcia
Copy link
Author

jmichelgarcia commented Mar 13, 2024

If it wasn't intentional, I was hoping hugo would offer a way to opt-out (and preserve the old behaviour).

@jmichelgarcia
Copy link
Author

@jmooring looking at it again, the current implementation doesn't make much sense though
it's basically rendering

  • Architecture & System Requirements as architecture--system-requirements
  • Installer (Kubernetes - OpenShift) as installer-kubernetes---openshift

Before I embark on a fixing journey, I wanted clarity on whether this is intentional or not.

@bep
Copy link
Member

bep commented Mar 14, 2024

This is mentioned in the list of breaking changes (near the top) that was also in the release notes for v0.123.0:

#11455

#10104

@bep bep closed this as completed Mar 14, 2024
@jmichelgarcia
Copy link
Author

jmichelgarcia commented Mar 14, 2024

Thanks @bep and @jmooring

I think I'm an outlier because we have lots of pages with various special characters and spaces in them, which I will now correct.

I am however still puzzled on why the new behaviour is not consistent across different characters.
I did a quick check with Docsy and found the following:

filepath url
content/en/docs/Concepts & Tutorials/_index.md /docs/concepts--tutorials/
content/en/docs/Concepts - Tutorials/_index.md /docs/concepts---tutorials/
content/en/docs/Concepts-Tutorials/_index.md /docs/concepts-tutorials/
content/en/docs/Concepts (Tutorials)/_index.md /docs/concepts-tutorials/
content/en/docs/Concepts (Tutorials/_index.md /docs/concepts-tutorials/

Cheers.

@jmooring
Copy link
Member

@jmichelgarcia We'll handle further questions here:
gohugoio/hugoDocs#2487

Copy link

github-actions bot commented Apr 5, 2024

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 Apr 5, 2024
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

3 participants