Create AMP-Compatible Site in Svelte
- 1 minute read
You can make your SvleteKit site
AMP-compatible by setting amp
to true in your svelte.config.js
file, like this:
kit: {
amp: true,
...
},
...
Please note that you might want to avoid setting amp
to true
unless absolutely necessary, because client-side JavaScript (and client-side routing) will be disabled completely.
The AMP boilerplate styles will be automatically injected, and the development server will let you know if the AMP validator picks up any errors as you are building and testing your site.
Conclusion
Anyway, that’s how you go about making your SvelteKit site AMP-friendly. But again, I’d suggest avoiding this unless you are certain that you really need AMP support.