roneda
September 4, 2022, 12:55am
1
Hello everyone!
I’m using Hugo + GitHub to deploy to Netlify. I noticed that a directory beginning with a period has not been deployed:
https://bytenotfound.com/tags/.net-framework/
When I generate the site on my local machine with Hugo, the directory is there. But when it’s published by Netlify, the directory is not there (I downloaded the published content and confirm that the directory was not published).
My site name:
https://bytenotfound.netlify.app
https://bytenotfound.com/
My GitHub repo: https://github.com/roneda/bytenotfound
Is it possible to publish a directory beginning with a period?
coelmay
September 4, 2022, 1:21am
2
Hey @roneda
Dot files/directories are ignored (e.g. .well-known
, .git
). You can get around this by creating a rewrite as outlined in this post
Hi, @Isabella . Actually there is a workaround, for the folders starting with a dot being ignored as well. The workaround is to use the redirect to “add” the dot back to the beginning of the path.
This works as follows.
Instead of making the directory .well_known/ make it just well_known without the preceeding . character.
Then make a redirect rule like so:
/.well_known/* /well_known/:splat 200
With that rule, you can upload the file as /well_known/something_here but successfully request th…
roneda
September 4, 2022, 6:50pm
3
Hi @coelmay , thank you! This is how I solved, based on your suggestion:
First, on netlify.toml, I appended the mv command after the hugo build command, to rename the directory from “.net-framework” to “net-framework” (without the dot)
command = "hugo --gc --minify && mv public/tags/.net-framework/ public/tags/net-framework/"
This ensures that the content of “net-framework” is published by Netlify.
Then, I added a redirect rule on netlify.toml:
[[redirects]]
from = "/tags/.net-framework/"
to = "/tags/net-framework/"
status = 200
This way, when someone access the path with the dot, he is redirected to the path without the dot where the content can be found!
Thanks a lot!
1 Like