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

Base path customization for some pages (not the whole website) #1031

Closed
zwz opened this issue Dec 18, 2019 · 1 comment
Closed

Base path customization for some pages (not the whole website) #1031

zwz opened this issue Dec 18, 2019 · 1 comment

Comments

@zwz
Copy link

zwz commented Dec 18, 2019

Is your feature request related to a problem? Please describe.
I read https://sapper.svelte.dev/docs/#Base_URLs, it tells how to set base path for the whole website.
And I find that %sapper.base% in template.html is replaced by <base href="/"> by default.

But I want to customize the base path for some pages, for example, to shorten the img src.

Describe the solution you'd like
I tried to add in those pages

<svelte:head>
    <base href="/the-path-to-img-root/" />
</svelte:head>

But since the first base path (by %sapper.base%) takes effect, it does not work.

So I think maybe %sapper.base% should be commented out of template.html.
And all the href values in %sapper.styles% and %sapper.head% should start with %sapper.base%.

This would make base path customization for some pages possible by <svelte:head>.

How important is this feature to you?
I think this is quite important.
To shorten the src is just one example.
Since the path may contain params, it would be easier for the page to set the base path, and the components on this page has no idea of the params.

@Conduitry
Copy link
Member

See #904. Sapper currently needs there to be a single site-wide base path, and we realize that's often inconvenient, but there are some hurdles to removing that requirement.

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

2 participants