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

Move site name to a config #36

Open
eecue opened this issue Mar 9, 2023 · 8 comments
Open

Move site name to a config #36

eecue opened this issue Mar 9, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@eecue
Copy link
Contributor

eecue commented Mar 9, 2023

Instead of having the site name in the command which lives in package.json:

"postbuild": "npx svelte-sitemap --domain https://eecue.com"

Could we move it somewhere else that can be populated dynamically at runtime? I use a config file for things like this:

import { config } from '$lib/config';

Ideally I could use that to populate the domain.

@bartholomej
Copy link
Owner

And have you tried this brand new version? #20
I am using this in production for a long time but I would appreciate some feedback from you

@eecue
Copy link
Contributor Author

eecue commented Mar 9, 2023

Didn't work:

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-static
  Wrote site to "build"
  ✔ done

> [email protected] postbuild
> npx svelte-sitemap

⚠ svelte-sitemap: --domain argument is required.

See instructions: https://github.com/bartholomej/svelte-sitemap

Example:

  svelte-sitemap --domain https://mydomain.com

My config:

$ cat svelte-sitemap.cjs       
import { config } from '$lib/config';
module.exports = {
	domain: config.baseURL.slice(0, -1),
	resetTime: false,
	debug: true
};

Version is the latest:

npx svelte-sitemap -h                
Svelte `sitemap.xml` generator

svelte-sitemap 2.6.0 (check updates: https://github.com/bartholomej/svelte-sitemap)

@bartholomej
Copy link
Owner

bartholomej commented Mar 9, 2023

Are you sure you installed next version? (3.0.0-next.7)

npm i svelte-sitemap@next

@eecue
Copy link
Contributor Author

eecue commented Mar 9, 2023

Oh, I missed that part. Trying now.

@eecue
Copy link
Contributor Author

eecue commented Mar 9, 2023

uh oh, looks like it's building giant single page sitemaps again... also I tried to load my external config as a value and got errors... any way to make this work:

module.exports = {
	domain: config.baseURL,
	resetTime: false,
	debug: true
};

@bartholomej
Copy link
Owner

bartholomej commented Mar 9, 2023

And if you try it without importing your config? Just put your domain there and try to build.

And what error do you have when you importing config?

@eecue
Copy link
Contributor Author

eecue commented Mar 9, 2023

It works fine when I don't include my config other than not splitting the files per the sitemap spec when there are more than 50k pages

@bartholomej
Copy link
Owner

Can you please describe how your whole config file looks like?
And in what configuration it doesn't work and what errors does it throw?

@bartholomej bartholomej added the enhancement New feature or request label Apr 21, 2023
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

2 participants