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

Allow arbitrary extensions (not just .html files) #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mikhuang
Copy link

@mikhuang mikhuang commented Aug 6, 2016

This may be too specific of a usage case but I needed to generate arbitrary file extensions, specifically .liquid files. Perhaps it will help someone?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling aed389f on mikhuang:master into 997318a on markdalgleish:master.

@markdalgleish
Copy link
Owner

markdalgleish commented Aug 30, 2016

Definitely open to this, especially since it makes this plugin more useful for static file generation in general—but wondering whether it would be better to either:

  1. Generate index.html files when a trailing slash is present, since it's clearly not a file name—this seems more predictable than basing it on the presence of a file extension; or
  2. Remove magic index.html file generation entirely, and make file names really explicit.

What do you think?

cc @KyleAMathews, would either of these changes impact Gatsby in any negative way?

@KyleAMathews
Copy link

Nope, shouldn't be a problem. Gatsby fully controls paths so it'd be easy to adjust if there's any breaking changes.

@markdalgleish
Copy link
Owner

@KyleAMathews not that it affects Gastby in any way, but what are your thoughts from an API design perspective? Do you have a preference?

@KyleAMathews
Copy link

My personal preference is always for "clean" urls e.g. /about/index.html and I haven't heard anyone ask yet for something different. That being said, options are good especially if you're porting an older site that does have about.html style urls.

Copy link

@nonphoto nonphoto left a comment

Choose a reason for hiding this comment

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

This looks like it should work fine. Can it be merged? I am also having this problem.

@slorber
Copy link

slorber commented Aug 31, 2020

Hey,

We are using this plugin on Docusaurus 2 and have a few issues due to using /pathName/index.html as many host providers will redirect 302 from /pathname to /pathname/ (facebook/docusaurus#3372)

That would be nice if it was possible to customize the fs filename path creation.

@markdalgleish do you still maintain this project? Otherwise, I'd probably maintain my own fork.

@slorber
Copy link

slorber commented Aug 31, 2020

@KyleAMathews

My personal preference is always for "clean" urls e.g. /about/index.html and I haven't heard anyone ask yet for something different. That being said, options are good especially if you're porting an older site that does have about.html style urls.

I also prefer "clean URLs" without extensions, but /about/index.html could be written as /about.html and yet be served from /about? Many users won't like to have the trailing slash and the URL being /about/ instead of /about, and host providers like Netlify will add it.

I've a similar problem on my Gatsby / Novela / Netlify blog here: https://sebastienlorber.com/records-and-tuples-for-react
The canonical page is a 302 redirect to the same URL with a trailing slash, and then reach-router removes that trailing slash on hydration. That's annoying 😅

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 this pull request may close these issues.

None yet

6 participants