gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.38k stars 7.49k forks source link

A title with a # will generate invalid links #11890

Closed vanbroup closed 9 months ago

vanbroup commented 9 months ago
---
date: 2024-01-15 14:00:00
title: A title with a # will generate invalid links
type: post
---

Some content here

config.yaml

permalinks:
  posts: /:year/:month/:day/:title/

Will generate a link like: "/2024/01/15/a-title-with-a-#-will-generate-invalid-links/", where everything after the # will be treated as a fragment.

jmooring commented 9 months ago

Duplicate of https://github.com/gohugoio/hugo/issues/4926.

Workaround (sort of):

vanbroup commented 9 months ago

Thanks @jmooring, sorry that I missed that, that issue is 6y old 🤔

It doesn't sound as difficult problem to resolve, manually setting the slug is not something that is easy to explain to users and this doesn't seem to be an intended behavior.

I was looking to create a quick fix but couldn't find where the urlize runs, I thought in permalink.go any suggestions where this is handled? Maybe I can create a fix including some new tests.

jmooring commented 9 months ago

I wouldn't spend any time on this until https://github.com/gohugoio/hugo/pull/11830 is merged and the dust settles.

github-actions[bot] commented 8 months ago

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.