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

Dynamic replacement of urls specified in sitemap #248

Open
Firq-ow opened this issue Oct 24, 2024 · 0 comments
Open

Dynamic replacement of urls specified in sitemap #248

Firq-ow opened this issue Oct 24, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Firq-ow
Copy link

Firq-ow commented Oct 24, 2024

Clear and concise description of the problem

I am running a setup where my site is deployed to http://localhost:8081/ during my CI runs. Unlighthouse is configured to run against this url.
I also provide a sitemap which is automatically generated during build and points to the actual url https://example.com/.

The issue now is that unlighthouse will refuse to parse and use the sitemap because the origin is different (as stated by the logs). This results in all routes that nested deeper to be missed due to unlighthouse not knowing these exist.

Suggested solution

I would love to have the option to reconfigure unlighthouse so that any routes in the sitemap get re-written to match a given override. It may look similar to this:

export default {
  site: "http://localhost:8081",
  sitemap_origin: "https://example.com"
}

The parameter name could be anything in this regard (sitemap_origin, sitemap_override, ...).

Alternatively, unlighthouse could automatically try to use the sitemap, replacing the origin with the given site. However, I would prefer an explicit solution over some implicit replacement.

Alternative

A current workaround is to add all possible routes to the config in advance. However, this is very tedious and doesn't scale well with sites that generate routes on the fly, for example when content collections are being used.

Additional context

Dynamically reading the links from the pages is not an option in this context, as the links are already pointing to https://example.com/ when the site finishes building.

Feel free to reach out for further details, I can provide the project infos if necessary.

@Firq-ow Firq-ow added the enhancement New feature or request label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant