Skip to content

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

Closed

Description

@frjo

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/

Activity

  1. bep commented on Jun 10, 2017

    @bep
    Member

    You should create an issue about one thing.

  2. frjo commented on Jun 10, 2017

    @frjo
    Author

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

  3. changed the title [-]removePathAccents true leave dot and forward slash in permalinks[/-] [+]Title used in permalink does not have dot and forward slash replaced[/+] on Jun 10, 2017
  4. tsuereth commented on Nov 16, 2017

    @tsuereth

    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.

  5. moorereason commented on Nov 21, 2017

    @moorereason
    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.

  6. 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[/+] on Nov 21, 2017
  7. stale commented on Feb 19, 2018

    @stale

    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.

  8. tcg commented on Jul 10, 2018

    @tcg

    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.

  9. self-assigned this
    on Oct 11, 2018
  10. added this to the v0.50 milestone on Oct 11, 2018
  11. moorereason commented on Oct 11, 2018

    @moorereason
    Contributor

    Fixed in #5282

  12. max-arnold commented on Feb 3, 2019

    @max-arnold
    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 😞

  13. sgumirov commented on May 2, 2020

    @sgumirov

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

  14. moorereason commented on May 2, 2020

    @moorereason
    Contributor

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

  15. locked as resolved and limited conversation to collaborators on May 2, 2020
  16. added a commit that references this issue on Aug 31, 2026
    39507d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions