-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Outputting extensionless file (like _headers
) from template
#83
Comments
_headers
file_headers
) from template
I see some problems requiring trailing slash. For example if One solution could be allow to set an object with properties for the url value. For example: ---
url:
filename: _headers
extension: false
--- The What do you think? |
I like it. Should |
url:
directory: /posts/hello-word/
filename: index
extension: .html If the directory is not defined, the src directory of the file will be used. But I like more your idea of using url:
path: /post/hello-word/index
extension: .html The difference between using this object and a string like |
That makes sense and I think this looks pretty good now. Should the value used to omit the extension be So the solution for this specific use case would be the following: url:
path: /_headers
extension: null |
Yes, a null or empty string is better. Or maybe nothing: url:
path: /_headers In this case, the extension would be empty. |
@valtlai I just implemented this new feature. You can see an example here and the expected output here. |
That’s nice. However, relative paths aren’t supported with an object. Should them? |
Good point. I don't see why not. I'll add it. |
One more question: How should a path with a trailing slash work? url:
path: /foo/ This currently throws an error. Is it ok or should it output |
I think it's ok the error. This is the explicit way to define the output file, so I wouldn't change the value introduced by the user. |
That’s fine. I think this is ready, so closing. |
The commit 772f9e0 also changed how the following works: ---
url: /404.html
--- Before the commit, |
No, it's not intended. Let me see. |
This didn’t work even before the commit, but I think an input file |
I think it's fixed now. And subextensions like |
Thank you! It seems working now, so closing. :) |
I would like to dynamically generate a
_headers
file to configure HTTP headers for Netlify. (And I’m going to do something similar with_redirects
too.)There’s no way to output a file named
_headers
from a template (i.e. without usingsite.copy()
). SettingslugifyUrls: false
in the config file andurl: /_headers
in a front matter results a file_headers/index.html
(or_headers.html
ifprettyUrls: false
).The problem is that the
_headers
file has no file extension and Lume adds.html
for missing one.Should we stop adding the extension and only add
index.html
ifurl
has a trailing slash? Thenurl: /foo
would output/foo
andurl: /foo/
would output/foo/index.html
. Or should there be an option (such asforceExtensions: false
) for this behavior?The text was updated successfully, but these errors were encountered: