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

Cloudflare Pages solution #37

Open
jasongitmail opened this issue Mar 18, 2023 · 3 comments
Open

Cloudflare Pages solution #37

jasongitmail opened this issue Mar 18, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@jasongitmail
Copy link

jasongitmail commented Mar 18, 2023

Wanted to share how to get this working with Cloudflare Pages successfully.

  1. Use import adapter from '@sveltejs/adapter-cloudflare'; instead of adapter-auto
  2. Add the following within the kit property within svelte.config.js
		adapter: adapter({
			routes: {
				include: ['/*'],
				exclude: ['<all>']
			}
		})
  1. In package.json, use "postbuild": "npx svelte-sitemap --out-dir .svelte-kit/cloudflare --domain https://example.com --debug"
@MellenIO
Copy link
Contributor

In my case, this wasn't all I needed. I also needed to add /sitemap.xml to the exclude parameter like:

		adapter: adapter({
			routes: {
				include: ['/*'],
				exclude: ['<all>', '/sitemap.xml']
			}
		})

Without this, https://example.com/sitemap.xml would still route in through kit

Would probably be good to add this to the readme/docs?

@bartholomej bartholomej added the documentation Improvements or additions to documentation label Apr 21, 2023
@Zundrium
Copy link

Zundrium commented Jun 14, 2024

Sorry to reopen this issue, but for some reason, even with "/sitemap.xml" in the exclude list, the kit is still giving a 404 for me. I resorted to adding the sitemap.xml to the /static folder.

@Cayllen
Copy link

Cayllen commented Oct 11, 2024

Same problem for me. I use dynamic path rewriting for i18n aka mydomain.com/en /de
Theoretically this should not be a problem but it does not work for some reason

What seems to help for me is to add a dummy sitemap.xml file in the /static folder (can be empty). Then it will be shown correctly when deployed. When using npm run build && npm run preview only shows the empty version tho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants