Intro to Headless WordPress with SvelteKit
The “Headless WordPress with SvelteKit” is a presentation given by Kellen Mace at the Svelte Summit conference in fall, 2021. This presentation introduces the concept of Headless WordPress, which decouples the front-end and back-end of a WordPress site. The SvelteKit app showcased in the presentation demonstrates how to utilize the WPGraphQL plugin to fetch data from a local WordPress site and integrate it with a Svelte front-end.
Follow the steps below to install and run the SvelteKit app:
.env.local file and define an environment variable as follows:VITE_PUBLIC_WORDPRESS_API_URL=http://sveltesummit.local/graphql
Replace “http://sveltesummit.local” with the domain of your local WordPress site.
npm install
npm run dev
The “Headless WordPress with SvelteKit” presentation introduces the concept of Headless WordPress and showcases a SvelteKit app that integrates with a local WordPress site using the WPGraphQL plugin. The app demonstrates how easy it is to fetch data from a WordPress site’s GraphQL API and leverage it in a Svelte front-end.