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

Document backslash escaping in the url front matter field #2737

Closed
2 tasks done
jmooring opened this issue Oct 14, 2024 · 0 comments · Fixed by #2739
Closed
2 tasks done

Document backslash escaping in the url front matter field #2737

jmooring opened this issue Oct 14, 2024 · 0 comments · Fixed by #2739

Comments

@jmooring
Copy link
Member

jmooring commented Oct 14, 2024

Pending merge/release of gohugoio/hugo#12938.

See gohugoio/hugo#12918 for examples.

Wait until these are resolved:

Notes:

Hugo does not sanitize the url front matter field. This means you have the ability to generate:

  • File paths that contain characters reserved by the operating system. For example, a file path on Windows may not contain a colon (:). Hugo throws an error if you include reserved characters. Learn more about Windows file naming conventions.
  • URLs that contain disallowed characters. For example, the less than sign (<) is not allowed in a URL.

If you need to include a colon in the url front matter field, escape it with backslash characters. Use one backslash if you wrap the string within single quotes, or use two backslashes if you wrap the string within double quotes. As described above, this will fail on Windows because the colon (:) is a reserved character.

@jmooring jmooring changed the title Document backslash escaping in url and permalinks Document backslash escaping in the url front matter field Oct 16, 2024
jmooring added a commit to jmooring/hugo-docs that referenced this issue Oct 16, 2024
Advise that the field is not sanitized, and describe how to include a
colon character.

Closes gohugoio#2737
jmooring added a commit to jmooring/hugo-docs that referenced this issue Oct 16, 2024
Advise that the field is not sanitized, and describe how to include a
colon character.

Closes gohugoio#2737
jmooring added a commit to jmooring/hugo-docs that referenced this issue Oct 16, 2024
Advise that the field is not sanitized, and describe how to include a
colon character.

Closes gohugoio#2737
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant