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 use of filenames in exportPathMap #2973

Merged
merged 5 commits into from Oct 5, 2017

Conversation

jesseditson
Copy link
Contributor

@jesseditson jesseditson commented Sep 21, 2017

I was working on a docs site that mirrored the content from a github repo, and decided to use the new next export to build the static site.

However, I expected that I could put any valid file path in exportPathMap as keys and it would render to that path. I was disappointed to find that a path of foo/bar.html would actually render as foo/bar.html/index.html, which would break links in my case (I'm wrapping content with plain anchors that I don't want to transform to dynamic links).

This PR changes the output (and any links to it) to be the path specified (without adding index.html) if path.extname(key) is not empty.

@timneutkens timneutkens requested a review from arunoda Sep 27, 2017
@langri-sha
Copy link

@langri-sha langri-sha commented Oct 4, 2017

Would this not fit as a better solution #2699 🙈?

@jesseditson
Copy link
Contributor Author

@jesseditson jesseditson commented Oct 4, 2017

After reading #2699 it looks like this may be helpful for solving that PR breaking export, but otherwise unrelated - does that sound right? If so, this one could land before that one and it would be easy to test. Could integrate on another branch if that would speed up one or both of these PRs.

@jesseditson
Copy link
Contributor Author

@jesseditson jesseditson commented Oct 4, 2017

Also @arunoda LMK when I should rebase this, I'll hold off until I hear from ya.

@nelak
Copy link

@nelak nelak commented Oct 4, 2017

@jesseditson The export issue mentioned in #2699 is unrelated to this.
That issue relates only to exporting when using typescript and it is fixed by modifying tsconfig.json as explained in the PR.
@timneutkens was reviewing #2699 the other day, I believe he should be able to point you in the right direction.

@timneutkens
Copy link
Member

@timneutkens timneutkens commented Oct 5, 2017

@jesseditson PR looks 👌
Just to verify:
This will be the possible cases right? 😄
/ => /index.html
/abc => /abc/index.html
/abc.html => /abc.html
/abc.md=> /abc.md

I've hit the magic rebase button for you 👍

Oh and we should document this 🙌 So if the above is correct and you've added the docs I'll merge 💯

@jesseditson
Copy link
Contributor Author

@jesseditson jesseditson commented Oct 5, 2017

@timneutkens cool, added a small note to the readme - to me this change is intuitive so I assume that's enough, but happy to add more docs if you'd like! The tests should be helpful for curious folks too.

Let me know if there's anything else you'd like me to update!

@jesseditson
Copy link
Contributor Author

@jesseditson jesseditson commented Oct 5, 2017

Oh and yes, those possible cases look correct to me!

Copy link
Member

@timneutkens timneutkens left a comment

Awesomeness, just my curiosity, you're really exporting a Next app to markdown 😲

@timneutkens timneutkens merged commit a79357f into vercel:master Oct 5, 2017
3 checks passed
@jesseditson
Copy link
Contributor Author

@jesseditson jesseditson commented Oct 6, 2017

Hehe still exporting html, but I'm exporting docs from a GitHub repo to an s3 static site, and wanted the paths to match so the links would work both on GitHub and the website. Content-Type sent by s3 is text/html though!

@jesseditson jesseditson deleted the export_files branch Oct 6, 2017
@timneutkens
Copy link
Member

@timneutkens timneutkens commented Oct 7, 2017

😄 Nice, this was released in latest beta 🙌

@jesseditson
Copy link
Contributor Author

@jesseditson jesseditson commented Oct 7, 2017

Amazing, thanks again!

rosszurowski added a commit to rosszurowski/rosszurowski.com that referenced this issue Oct 9, 2017
A [recent change](vercel/next.js#2973) in Next
allowed for paths to be exported directly, meaning we can now generate
404.html straight from the config. This changes the build to use the
redirect page to generate 404.html directly.
@lock
Copy link

@lock lock bot commented May 10, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants