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

chore(docs): Pre-encoded unicode characters can't be used in paths #36325

Merged
merged 3 commits into from
Aug 9, 2022

Conversation

Auspicus
Copy link
Contributor

@Auspicus Auspicus commented Aug 4, 2022

Description

I ran into this weird behavior when creating a multilingual site where the paths were coming pre-encoded from the CMS. I was expecting that Gatsby would recognise pre-encoded paths and make the necessary adjustments so that I wouldn't have to handle anything in gatsby-node but I later found that paths MUST be encoded or pages break and bad things happen :o

I think this could be changed internally so that we don't have to rely on the developer to pass the correct value and instead handle the encoding inside Gatsby. For the meantime however, a docs update should suffice so that developers don't have to dig into the internals to understand whether or not unicode is supported and how to use it.

TLDR; Made a few changes to the API docs to mention how paths should not be encoded when containing unicode characters.

Documentation

  • Add a section into the path field description in createPage API
  • Add a section in the routing docs explaining that path is not expected to be encoded

Related Issues

Related to #16765

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Aug 4, 2022
@Auspicus
Copy link
Contributor Author

Auspicus commented Aug 5, 2022

@LekoArts I went ahead and updated the docs to note the way that createPage is currently expecting the path param to not be encoded based on that old ticket: #16765. Is this the right direction or should there be a change to the API to support encoded paths?

@marvinjude marvinjude added type: documentation An issue or pull request for improving or updating Gatsby's documentation and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Aug 5, 2022
@LekoArts LekoArts changed the title docs(gatsby): Update Routing docs to reflect that pre-encoded unicode characters can't be used in paths chore(docs): Pre-encoded unicode characters can't be used in paths Aug 9, 2022
Copy link
Contributor

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@LekoArts LekoArts merged commit 0ed362c into gatsbyjs:master Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants