Describe the bug
When using adapter-static, you can list out the pages you want to prerender in kit.prerender.pages, but query strings confuse the system. They get appended to the directory name, and the index.html that should be inside is missing.
Why would you want to? Imagine you have a page with 3 tabs and want to pre-render each of them, like:
/page?tab=1
/page?tab=2
/page?tab=3
To Reproduce
Use a config like this, then npm run build with adapter-static.
prerender: {
pages: [
'*',
'/about?foo=bar',
]
}
Expected behavior
The most reasonable thing would be to put the query string on the index.html file, either before the extension or after, not sure what is better. You can see the code where URLSearchParams is just made empty all the time.
|
query: new URLSearchParams() |
In the above example the resulting artifacts might be:
/page/index.html?page=1
/page/index.html?page=2
/page/index.html?page=3
or
/page/index?page=1.html
/page/index?page=2.html
/page/index?page=3.html (keeps the file extensions the same for OS file open support maybe?)
Seems like an easy fix, I'll probably fix myself.
Severity
Not severe.
Describe the bug
When using adapter-static, you can list out the pages you want to prerender in kit.prerender.pages, but query strings confuse the system. They get appended to the directory name, and the index.html that should be inside is missing.
Why would you want to? Imagine you have a page with 3 tabs and want to pre-render each of them, like:
/page?tab=1
/page?tab=2
/page?tab=3
To Reproduce
Use a config like this, then
npm run buildwith adapter-static.Expected behavior
The most reasonable thing would be to put the query string on the index.html file, either before the extension or after, not sure what is better. You can see the code where URLSearchParams is just made empty all the time.
kit/packages/kit/src/core/adapt/prerender.js
Line 126 in 5418254
In the above example the resulting artifacts might be:
/page/index.html?page=1
/page/index.html?page=2
/page/index.html?page=3
or
/page/index?page=1.html
/page/index?page=2.html
/page/index?page=3.html (keeps the file extensions the same for OS file open support maybe?)
Seems like an easy fix, I'll probably fix myself.
Severity
Not severe.