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

Can filename contain "()" and "$" ? #5737

Closed
ssy341 opened this issue Mar 6, 2019 · 7 comments
Closed

Can filename contain "()" and "$" ? #5737

ssy341 opened this issue Mar 6, 2019 · 7 comments

Comments

@ssy341
Copy link

ssy341 commented Mar 6, 2019

Hi all,
I have one file named "$().md", I access "http://localhost:1313/$()/" or "http://localhost:1313/%24()/" both returns 404 code. I have no idea about this. What should I do?

here is $().md file content

+++
title = "$()"
+++
Hello hugo
@bep
Copy link
Member

bep commented Mar 6, 2019

Have you tried renaming the file?

@ssy341
Copy link
Author

ssy341 commented Mar 6, 2019

thanks @bep
but I can't rename the file, this filename is about jQuery plugin‘s API, if I change the filename then the content doesn't match API name, it makes confusing

@bep
Copy link
Member

bep commented Mar 6, 2019

then the content doesn't match API name, it makes confusing

Sure, but I'm pretty sure $() isn't a valid URL, so at some point you need to adjust it. And you can have anything you want in the title.

@ssy341
Copy link
Author

ssy341 commented Mar 7, 2019

@bep I run hugo server --renderToDisk command then generate the files in public folder. I found out hugo will ignore "()" or "$" character. I use jekyll to generate website before, the same filename can be generated. I can access "http://localhost:4000/%24()" get the page. For hugo, this result count a bug? Or I did a wrong way?

image
image

@stale
Copy link

stale bot commented Jul 5, 2019

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 Jul 5, 2019
@stale stale bot closed this as completed Aug 4, 2019
@steven-linden
Copy link

I ran into a similar problem when some of my markdown files have the : character embedded in their name, and when they were converted to HTML by Hugo, the : characters were dropped and the resulting filename wasn't what we were expecting.

Eventually, I traced this to path.go where the filenames are sanitized, and issue 1292 (where the % characters are stripped out of filenames) also seems relevant.

I understand the reasoning for not allowing certain characters in filenames because they are not permitted in the URL specs, and that doing the percent-encoding may not be within the scope of Hugo (plus, certain cloud storage providers do their own encoding on upload, which can further complicate matters).

However, I didn't see any mention in the documentation regarding which characters are permitted to be used in filenames, and which ones will be dropped; nor does the documentation indicate that these characters will be dropped silently, even when running Hugo in verbose mode.

@bep - I am happy to add this information into the documentation, but would appreciate a pointer to a suitable location to do so. If the information is already there, could it be made more obvious?

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2022
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

3 participants