Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Export and relative URL #89

Closed
rap2hpoutre opened this issue Jan 16, 2018 · 2 comments
Closed

Export and relative URL #89

rap2hpoutre opened this issue Jan 16, 2018 · 2 comments

Comments

@rap2hpoutre
Copy link

rap2hpoutre commented Jan 16, 2018

After exporting the default sapper-template with the npx sapper export command, I would like to use it somewhere in a subfolder. It works if I serve it via http://example.org (with nginx or similar) but not if I host it in a subfolder http://example.org/my-sapper-website (example: if I want to host it on Github Pages). It's because all URL starts with slashes in routes and templates. I could change all the URL to make them relatives (removing the slash in HTML), but I not sure it's the right way.

Is there a way to export for hosting in subfolder without rewriting all the routes files?

Sorry if it's not the right place to ask this kind of questions, maybe I should have posted on Stackoverflow

@EmilTholin
Copy link
Member

EmilTholin commented Jan 16, 2018

Hi @rap2hpoutre! That's a good point. There is currently no way to achieve this.

It might be worth exploring if the CLI could be expanded to take an argument to specify a base URL, which could be added to relative URLs when the a tags are extracted.

sapper export --baseurl=http://example.org/my-sapper-website

@Rich-Harris
Copy link
Member

I'm going to close this issue in favour of #180, as it's something that also applies to non-exported sites, so we should have a fix that covers both scenarios

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants