Skip to content

kit.prerender.pages can't handles paths with query strings #1825

Description

@jp-simons

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions