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

Title used in permalink does not have forward slash escaped #3577

Closed
frjo opened this issue Jun 10, 2017 · 10 comments
Closed

Title used in permalink does not have forward slash escaped #3577

frjo opened this issue Jun 10, 2017 · 10 comments
Assignees
Milestone

Comments

@frjo
Copy link

frjo commented Jun 10, 2017

I have this permalink set up for posts.

permalinks:
  post: "/post/:year/:month/:day/:slug"

Characters like a dot and forward slash in the posts title does not get replaced in the generated permalink for the post.

This example title

Lorem ipsum dolor sit amet/consectetur do example.org

generates the following permalink

/post/2006/02/02/lorem-ipsum-dolor-sit-amet/consectetur-do-example.org/

I had hoped it would become

/post/2006/02/02/lorem-ipsum-dolor-sit-amet-consectetur-do-example-org/
@bep
Copy link
Member

bep commented Jun 10, 2017

You should create an issue about one thing.

@frjo
Copy link
Author

frjo commented Jun 10, 2017

Better now? The removePathAccents part was due to bad testing by me, it has nothing to do with the problem.

@frjo frjo changed the title removePathAccents true leave dot and forward slash in permalinks Title used in permalink does not have dot and forward slash replaced Jun 10, 2017
@tsuereth
Copy link

tsuereth commented Nov 16, 2017

I've recently been working on a similar issue (for taxonomy terms), and while I was in there, I put in a fix for slashes in titles. See #4092 ; for your example, this will generate-

/post/2006/02/02/lorem-ipsum-dolor-sit-amet-consectetur-do-example.org/

My changes don't do anything with dots -- for my hugo site, the dots are fine. But, it seems to me like it could make sense to add a configurable flag like "disallowDotsInPathSegments" (or, probably a shorter flag name) to optionally alter that behavior.

Does this sound right to you? If my PR is accepted, I could follow it up with something like that.

@moorereason
Copy link
Contributor

@frjo,
You raise two issues:

  1. Forward slashes: Agreed. Similar to Slashes in a taxonomy term break path resolution #4090. Can likely solve at the same time.

  2. Dots: I see no reason to treat a dot as a special case. They have no special, reserved meaning in file system paths or URLs.

I'm renaming this issue to focus on the forward slash problem. If you want to argue for the dots escaping, open a separate issue.

@moorereason moorereason changed the title Title used in permalink does not have dot and forward slash replaced Title used in permalink does not have forward slash escaped Nov 21, 2017
@stale
Copy link

stale bot commented Feb 19, 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 19, 2018
@moorereason moorereason added Keep and removed Stale labels Feb 20, 2018
@tcg
Copy link

tcg commented Jul 10, 2018

Apologies if I shouldn't "me, too", but just noticed this in 0.42.2 and 0.43. I originally ran across it because of hash marks, which I fully expected to be escaped, which I detailed here: https://discourse.gohugo.io/t/hash-pound-sign-not-escaped-in-title-permalink-breaking-urls/12825

I was asking there if I should open a separate issue, but was open to the possibility that I am just doing something wrong. Glad to document and file a bug if necessary.

@moorereason
Copy link
Contributor

Fixed in #5282

@max-arnold
Copy link
Contributor

Could anyone test this again with Hugo 0.54.0? After #5571 was merged, slashes in titles are not escaped anymore (at least for me). I think this issue should be reopened 😞

@sgumirov
Copy link

sgumirov commented May 2, 2020

I can confirm regression with slash is not being escaped in url. Any config flags to enable this?

@moorereason
Copy link
Contributor

This issue has been closed for months. Please open a new issue.

@gohugoio gohugoio locked as resolved and limited conversation to collaborators May 2, 2020
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

7 participants