How do I set up a SvelteKit Starter Blog with Hygraph?
To set up a SvelteKit Starter Blog with Hygraph, you can use the predefined "Blog Starter" template available in your Hygraph dashboard. This template comes with a pre-defined content schema. After creating a free Hygraph account, select the "Blog Starter" template when creating a new project, name your project, and choose whether to include template content. Once the project is created, you can access the API and start building your blog. Note: The starter template is best suited for basic blog setups; advanced customization may require manual schema adjustments. Source
What are the prerequisites for using the SvelteKit Starter Blog with Hygraph?
You need a basic web development setup including Node.js, a terminal (bash, zsh, or fish), a text editor (such as VSCode), and a GitHub account. Note: Familiarity with SvelteKit and npm is recommended for smooth setup. Source
How long does it take to implement Hygraph for a new project?
Implementation timelines vary by project complexity. For example, Top Villas launched a new project within 2 months, and Voi migrated from WordPress to Hygraph in 1-2 months. Starter projects and templates can help accelerate onboarding. Note: Complex integrations or custom schemas may extend implementation time. Source
Features & Capabilities
What features does Hygraph offer for content management and blogging?
Hygraph provides a GraphQL-native Headless CMS with predefined schema templates, content federation, granular permissions, localization, and Smart Edge Cache for performance. The platform supports user-friendly tools for non-technical users, enabling independent content updates. Note: Advanced features like content federation and Smart Edge Cache are best suited for enterprise and global teams; basic users may not need all capabilities. Source
Does Hygraph support GraphQL APIs for querying blog content?
Yes, Hygraph offers a high-performance GraphQL Content API for querying and manipulating content programmatically. The API is optimized for low latency and high read-throughput. Developers can use tools like graphql-request to query blog posts and other content. Note: API access requires proper configuration of permissions and published content stages. Source
What integrations are available for Hygraph?
Hygraph supports integrations with Digital Asset Management systems (Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, Scaleflex Filerobot), hosting platforms (Netlify, Vercel), Product Information Management (Akeneo), translation/localization (EasyTranslate), commerce solutions (BigCommerce), and more. For a full list, visit Hygraph's Marketplace. Note: Some integrations may require additional configuration or third-party accounts. Source
How does Hygraph perform in terms of content delivery and API speed?
Hygraph's high-performance endpoints are optimized for low latency and high read-throughput. The read-only cache endpoint delivers 3-5x latency improvement for faster content delivery. API performance is actively measured and documented in the GraphQL Report 2024. Note: Performance may vary based on project complexity and API usage patterns. Source
Technical Requirements & Documentation
Where can I find technical documentation for Hygraph and SvelteKit integration?
Hygraph provides extensive technical documentation including API reference, schema components, integration guides, and getting started tutorials. For SvelteKit integration, refer to the blog guide and the API Reference documentation. Note: Documentation for advanced features may require familiarity with GraphQL and SvelteKit. Source
What are the steps to deploy a SvelteKit blog using Hygraph?
To deploy a SvelteKit blog using Hygraph, install the appropriate SvelteKit adapter (e.g., @sveltejs/adapter-vercel), configure your project, and use the Vercel CLI for deployment. Set the Hygraph API endpoint as an environment variable in your deployment settings. Note: Deployment to other platforms may require different adapters and configuration steps. Source
Security & Compliance
What security and compliance certifications does Hygraph have?
Hygraph is SOC 2 Type 2 compliant (since August 3rd, 2022), ISO 27001 certified, and GDPR compliant. Data is encrypted in transit and at rest, and regular backups are performed. Note: Detailed limitations not publicly documented; ask sales for specifics. Source
How does Hygraph ensure secure API access and data protection?
Hygraph provides granular permissions, SSO integrations (OIDC/LDAP/SAML), audit logs, encryption, and secure API policies including custom origin policies and IP firewalls. All endpoints have SSL certificates. Note: Security incident reporting process is available; for advanced requirements, consult Hygraph support. Source
Ease of Use & Customer Feedback
What feedback have customers given about Hygraph's ease of use?
Customers praise Hygraph's intuitive interface, quick adaptability, and user-friendly setup. For example, Sigurður G. (CTO) noted the UI is intuitive for normal users, and Charissa K. (Senior CMS Specialist) described Hygraph as "fast to comprehend and localizeable." Granular roles and permissions help prevent mistakes and streamline workflows. Note: Some advanced features may require technical expertise. Source
Use Cases & Business Impact
What business impact can customers expect from using Hygraph?
Customers report faster time-to-market (Komax achieved 3X faster launches), improved customer engagement (Samsung saw a 15% increase), cost reduction, and enhanced content consistency. Hygraph supports scaling operations and adapting to changing market needs. Note: ROI varies by project scope and industry; consult case studies for detailed metrics. Source
Who can benefit from using Hygraph?
Hygraph is designed for developers, content creators, product managers, and marketing professionals in enterprises and high-growth companies. Industries represented include SaaS, eCommerce, media, healthcare, automotive, and more. Note: Small teams may find some enterprise features unnecessary; evaluate based on project needs. Source
Customer Proof & Success Stories
Can you share specific case studies or success stories of customers using Hygraph?
Yes, notable examples include Samsung (15% improved engagement), Komax (3X faster time-to-market), AutoWeb (20% increase in monetization), Voi (scaled multilingual content across 12 countries), and HolidayCheck (reduced developer bottlenecks). For more, visit Hygraph's case studies page. Note: Results are project-specific; consult case studies for detailed outcomes.
Common Pain Points & Solutions
What common pain points does Hygraph address for content teams?
Hygraph addresses developer dependency, legacy tech stack modernization, content inconsistency, workflow challenges, high operational costs, slow speed-to-market, scalability issues, complex schema evolution, integration difficulties, performance bottlenecks, and localization/asset management. Note: Some pain points may require custom solutions or advanced configuration. Source
Styling & UI Customization
How can I style my SvelteKit blog built with Hygraph?
You can use Tailwind CSS and daisyUI for styling SvelteKit projects. Tailwind can be added via npx svelte-add tailwindcss --jit, and daisyUI plus Tailwind Typography can be installed for pre-built components and markdown styling. Note: Custom styling may require additional configuration in Tailwind and SvelteKit. Source
Get up and running with this starter, follow the guide, or use the completed project to get started in minutes.
Last updated by Scott
on Jan 21, 2026
Originally written by Scott
In this post, I'm going to detail setting up a starter blog using SvelteKit and Hygraph. This will be a guide on creating a basic blog using SvelteKit and Hygraph.
SvelteKit for the bleeding edge goodness that that brings and the Hygraph starter blog so I'm up and running quickly with content that I can later build on when I want to add more content and functionality to the project.
If you prefer to just have the starter files you can get the repo here and if you only want to have a template to get started with then check out the Deploy button on the GitHub repo.
For this starter, I'll be using the predefined and pre-populated "Blog Starter" template available to you on your Hygraph dashboard. The starter comes with a content schema already defined for you.
If you haven't signed up already and created a Hygraph account you can create a free account.
On your Hygraph dashboard select the "Blog Starter" template from the "Create a new project" section, you're then prompted to give it a name and description. I'll call my one "My Blog", pay attention to the "Include template content?" checkbox, in my case I'm going to leave this checked. I'll then select my region and "Create project".
I'm selecting the community pricing plan and I'll select "Invite later" for "Invite team members".
From the project dashboard, I can see from the quick start guide that the schema is already created and the API is accessible.
Clicking on the "Make your API accessible" section of the quick start guide I will be taken to the "API access" settings panel, from here I'm going to check the "Content from stage Published" checkbox and click "Save" so the API is publicly accessible.
Now, I have an accessible GraphQL endpoint to access the blog data from. Time to scaffold out the project to get the data.
I'm selecting Skeleton project, no TypeScript, ESLint and Prettier:
✔ Which Svelte app template? › Skeleton project
✔ Use TypeScript? … No
✔ Add ESLint for code linting? … Yes
✔ Add Prettier for code formatting? … Yes
Now I have the absolute bare-bones starter for a SvelteKit project.
Popping open VSCode in the project directory I can see what I have to work with:
# change directory
cd sveltekit-graphcms-starter-blog
# install dependencies
npm i
# open with VSCode
code .
The project outline looks a little like this:
sveltekit-graphcms-starter-blog/
├─ src/
│ ├─ routes
│ │ └─ index.svelte
│ ├─ app.html
│ └─ global.d.ts
Running npm run dev from the terminal will start the dev server on the default localhost:3000 you can edit this command to open the web browser on that port with some additional flags being passed to the npm run dev command:
Cool, cool, cool, now to start getting the data from the API to display on the client.
If I pop open the API playground on my Hygraph project, I can start shaping the data I want to get for the index page of my project.
I'll want to query all posts available and grab these fields to display on the index page:
queryPostsIndex{
posts{
id
title
slug
date
excerpt
}
}
I'm going to install graphql-request and graphql as dependencies so I can query the Hygraph GraphQL API endpoint with the query I defined in the API playground!
npm i -D graphql-request graphql
I'm copying my Access URL endpoint to a .env file which can be accessed in Vite with import.meta.env.VITE_HYGRAPH_URL. First up I'll create the file first, then add the variable to it with the accompanying Access URL:
In the src/routes/index.svelte file I'm using Svelte's script context="module" so that that I can get the posts from the Hygraph endpoint ahead of time. That means it’s run when the page is loaded and the posts can be loaded ahead of the page being rendered on the screen.
This can be abstracted away later for now it's to see some results on the screen:
<scriptcontext="module">
import{ gql,GraphQLClient}from'graphql-request'
exportasyncfunctionload(){
const hygraph =newGraphQLClient(
import.meta.env.VITE_HYGRAPH_URL,
{
headers:{},
}
)
const query = gql`
query PostsIndex {
posts {
id
title
slug
date
excerpt
}
}
`
const{ posts }=await hygraph.request(query)
return{
props:{
posts,
},
}
}
</script>
<script>
exportlet posts
</script>
<h1>Hygraph starter blog</h1>
<ul>
{#each posts as post}
<li>
<ahref="/post/{post.slug}">{post.title}</a>
</li>
{/each}
</ul>
I'll quickly break down what's happening here, as I mentioned earlier the first section contained in the <script context="module"> block is being requested before the page renders and that returns props: { posts }.
The next section is accepting the posts as a prop to use them in the markup the {#each posts as post} block is looping through the posts props and rendering out a list item for each post.slug with the post.title.
Running the dev server will now give me a list of posts available:
Cool! Clicking one of the links will give me a 404 error though, next up I'll create a layout and an error page.
Adding a layout will mean certain elements will be available on each page load, like a navbar and footer:
# create the layout file
touch src/routes/__layout.svelte
For now, a super simple layout so that users can navigate back to the index page:
<nav>
<ahref="/">Home</a>
</nav>
<slot/>
The <slot /> is the same as you would have in a React component that would wrap a children prop. Now everything in src/routes will have the same layout. As mentioned this is pretty simple but allows for styling of everything wrapped by the layout. Not mentioned styling yet, more on that soon(ish).
Now to the not found (404) page:
# create the layout file
touch src/routes/__error.svelte
Then to add some basic information so the user can see they've hit an undefined route:
<scriptcontext="module">
exportfunctionload({ error, status }){
return{
props:{ error, status },
}
}
</script>
<script>
exportlet error, status
</script>
<svelte:head>
<title>{status}</title>
</svelte:head>
<h1>{status}: {error.message}</h1>
Clicking on any of the links on the index page will now use this error page. Next up, creating the pages for the blog posts.
You may have noticed <svelte:head> in there, that's to add amongst other things SEO information, I'll use that in the components from now on where applicable.
That's a fancy way of saying the URL path for each blog post is generated programmatically.
Create a [slug].svelte file and posts folder in the src directory:
mkdir src/routes/post/
# not the quotes around the path here 👇
touch 'src/routes/post/[slug].svelte'
In <script context="module"> pretty much the same query as before but this time for a single post and using the GraphQL post query from the Hygraph endpoint.
To get the slug for the query I'm passing in the page context where I'm getting the slug from the page params:
<scriptcontext="module">
import{ gql,GraphQLClient}from'graphql-request'
exportasyncfunctionload(context){
const hygraph =newGraphQLClient(
import.meta.env.VITE_HYGRAPH_URL,
{
headers:{},
}
)
const query = gql`
query PostPageQuery($slug: String!) {
post(where: { slug: $slug }) {
title
date
content {
html
}
tags
author {
id
name
}
}
}
`
const variables ={
slug: context.page.params.slug,
}
const{ post }=await hygraph.request(query, variables)
return{
props:{
post,
},
}
}
</script>
<script>
exportlet post
</script>
<svelte:head>
<title>{post.title}</title>
</svelte:head>
<h1>{post.title}</h1>
<p>{post.author.name}</p>
<p>{post.date}</p>
<p>{post.tags}</p>
{@html post.content.html}
Take note of the last line here where I’m using the Svelte @html tag, this renders content with HTML in it.
Now I have a functional blog, not pretty, but functional.
Now to deploy this to Vercel! You're not bound to Vercel, you can use one of the SvelteKit adapters that are available.
npm i -D @sveltejs/adapter-vercel@next
Then I'll need to add that to the svelte.config file:
importvercelfrom'@sveltejs/adapter-vercel'
/** @type {import('@sveltejs/kit').Config} */
const config ={
kit:{
// hydrate the <div id="svelte"> element in src/app.html
target:'#svelte',
adapter:vercel(),
},
}
exportdefault config
Now to deploy to Vercel, I'll need the Vercel CLI installed, that's a global npm or Yarn install:
npm i -g vercel
# log into vercel
vc login
I'm prompted to verify the log in via email then I can use the CLI. I'll deploy with the vercel command from the terminal:
# run from the root of the project
vercel # or vc
I can go straight to production with this by using the --prod flag but before I do that I'll add the VITE_HYGRAPH_URL env value to the setting panel on the Vercel project page for what I've just deployed.
In the settings page of the Project, there's a section for "Environment Variables", the URL will be specific to your username and project name, it should look something like this:
In the Vercel UI for the Environment Variables, I'll add in the VITE_HYGRAPH_URL for the name and the Hygraph API endpoint for the value.
Now I can build again this time with the --prod flag:
vc --prod
That's it, I now have a functional blog in production! If you want to go ahead and style it yourself go for it! If you need a bit of direction on that I got you too!
Tailwind can be added to SvelteKit projects by using the svelte-add helper, there's loads to choose from in this case I'll be using it with JIT enabled:
# use svelte-add to install Tailwind
npx svelte-add tailwindcss --jit
# re-install dependencies
npm i
Tailwind will need the @tailwind directives so I'll create an app.css file in the src directory:
touch src/app.css
I'll add the base, components and utilities Tailwind directives to it:
@tailwind base;
@tailwind components;
@tailwind utilities;
Then I'll bring that into the layout, it could also be added directly to the src/app.html file as a link, in this instance I'll add it to the layout:
<script>
import'../app.css'
</script>
<nav>
<ahref="/">Home</a>
</nav>
<slot/>
Now onto adding the styles, I'm going to be using daisyUI which has a lot of pre-built components to use for scaffolding out a pretty decent UI quickly. I'm also going to use Tailwind Typography for styling the markdown.
npm i -D daisyui @tailwindcss/typography
Then add those to the Tailwind plugins array in the tailwind.config.cjs file:
I'm going to move the navigation out to its own component and import that into the layout, first up I'll create the lib folder, where component lives in SvelteKit:
mkdir src/lib
touch src/lib/nav.svelte
In the nav.svelte I'll add in one of the nav examples from daisyUI:
Same with the post page I'v amended the GraphQL query to bring back some additional data for the author image and the post tags; Here's what the query looks like:
queryPostPageQuery($slug:String!){
post(where:{slug:$slug}){
title
date
content{
html
}
tags
author{
name
title
picture{
fileName
url
}
}
coverImage{
fileName
url
}
}
}
I've added some Tailwind styles and brought in the author image. I'm also rendering out any tags if they're in the post data:
Get up and running with this starter, follow the guide, or use the completed project to get started in minutes.
Last updated by Scott
on Jan 21, 2026
Originally written by Scott
In this post, I'm going to detail setting up a starter blog using SvelteKit and Hygraph. This will be a guide on creating a basic blog using SvelteKit and Hygraph.
SvelteKit for the bleeding edge goodness that that brings and the Hygraph starter blog so I'm up and running quickly with content that I can later build on when I want to add more content and functionality to the project.
If you prefer to just have the starter files you can get the repo here and if you only want to have a template to get started with then check out the Deploy button on the GitHub repo.
For this starter, I'll be using the predefined and pre-populated "Blog Starter" template available to you on your Hygraph dashboard. The starter comes with a content schema already defined for you.
If you haven't signed up already and created a Hygraph account you can create a free account.
On your Hygraph dashboard select the "Blog Starter" template from the "Create a new project" section, you're then prompted to give it a name and description. I'll call my one "My Blog", pay attention to the "Include template content?" checkbox, in my case I'm going to leave this checked. I'll then select my region and "Create project".
I'm selecting the community pricing plan and I'll select "Invite later" for "Invite team members".
From the project dashboard, I can see from the quick start guide that the schema is already created and the API is accessible.
Clicking on the "Make your API accessible" section of the quick start guide I will be taken to the "API access" settings panel, from here I'm going to check the "Content from stage Published" checkbox and click "Save" so the API is publicly accessible.
Now, I have an accessible GraphQL endpoint to access the blog data from. Time to scaffold out the project to get the data.
I'm selecting Skeleton project, no TypeScript, ESLint and Prettier:
✔ Which Svelte app template? › Skeleton project
✔ Use TypeScript? … No
✔ Add ESLint for code linting? … Yes
✔ Add Prettier for code formatting? … Yes
Now I have the absolute bare-bones starter for a SvelteKit project.
Popping open VSCode in the project directory I can see what I have to work with:
# change directory
cd sveltekit-graphcms-starter-blog
# install dependencies
npm i
# open with VSCode
code .
The project outline looks a little like this:
sveltekit-graphcms-starter-blog/
├─ src/
│ ├─ routes
│ │ └─ index.svelte
│ ├─ app.html
│ └─ global.d.ts
Running npm run dev from the terminal will start the dev server on the default localhost:3000 you can edit this command to open the web browser on that port with some additional flags being passed to the npm run dev command:
Cool, cool, cool, now to start getting the data from the API to display on the client.
If I pop open the API playground on my Hygraph project, I can start shaping the data I want to get for the index page of my project.
I'll want to query all posts available and grab these fields to display on the index page:
queryPostsIndex{
posts{
id
title
slug
date
excerpt
}
}
I'm going to install graphql-request and graphql as dependencies so I can query the Hygraph GraphQL API endpoint with the query I defined in the API playground!
npm i -D graphql-request graphql
I'm copying my Access URL endpoint to a .env file which can be accessed in Vite with import.meta.env.VITE_HYGRAPH_URL. First up I'll create the file first, then add the variable to it with the accompanying Access URL:
In the src/routes/index.svelte file I'm using Svelte's script context="module" so that that I can get the posts from the Hygraph endpoint ahead of time. That means it’s run when the page is loaded and the posts can be loaded ahead of the page being rendered on the screen.
This can be abstracted away later for now it's to see some results on the screen:
<scriptcontext="module">
import{ gql,GraphQLClient}from'graphql-request'
exportasyncfunctionload(){
const hygraph =newGraphQLClient(
import.meta.env.VITE_HYGRAPH_URL,
{
headers:{},
}
)
const query = gql`
query PostsIndex {
posts {
id
title
slug
date
excerpt
}
}
`
const{ posts }=await hygraph.request(query)
return{
props:{
posts,
},
}
}
</script>
<script>
exportlet posts
</script>
<h1>Hygraph starter blog</h1>
<ul>
{#each posts as post}
<li>
<ahref="/post/{post.slug}">{post.title}</a>
</li>
{/each}
</ul>
I'll quickly break down what's happening here, as I mentioned earlier the first section contained in the <script context="module"> block is being requested before the page renders and that returns props: { posts }.
The next section is accepting the posts as a prop to use them in the markup the {#each posts as post} block is looping through the posts props and rendering out a list item for each post.slug with the post.title.
Running the dev server will now give me a list of posts available:
Cool! Clicking one of the links will give me a 404 error though, next up I'll create a layout and an error page.
Adding a layout will mean certain elements will be available on each page load, like a navbar and footer:
# create the layout file
touch src/routes/__layout.svelte
For now, a super simple layout so that users can navigate back to the index page:
<nav>
<ahref="/">Home</a>
</nav>
<slot/>
The <slot /> is the same as you would have in a React component that would wrap a children prop. Now everything in src/routes will have the same layout. As mentioned this is pretty simple but allows for styling of everything wrapped by the layout. Not mentioned styling yet, more on that soon(ish).
Now to the not found (404) page:
# create the layout file
touch src/routes/__error.svelte
Then to add some basic information so the user can see they've hit an undefined route:
<scriptcontext="module">
exportfunctionload({ error, status }){
return{
props:{ error, status },
}
}
</script>
<script>
exportlet error, status
</script>
<svelte:head>
<title>{status}</title>
</svelte:head>
<h1>{status}: {error.message}</h1>
Clicking on any of the links on the index page will now use this error page. Next up, creating the pages for the blog posts.
You may have noticed <svelte:head> in there, that's to add amongst other things SEO information, I'll use that in the components from now on where applicable.
That's a fancy way of saying the URL path for each blog post is generated programmatically.
Create a [slug].svelte file and posts folder in the src directory:
mkdir src/routes/post/
# not the quotes around the path here 👇
touch 'src/routes/post/[slug].svelte'
In <script context="module"> pretty much the same query as before but this time for a single post and using the GraphQL post query from the Hygraph endpoint.
To get the slug for the query I'm passing in the page context where I'm getting the slug from the page params:
<scriptcontext="module">
import{ gql,GraphQLClient}from'graphql-request'
exportasyncfunctionload(context){
const hygraph =newGraphQLClient(
import.meta.env.VITE_HYGRAPH_URL,
{
headers:{},
}
)
const query = gql`
query PostPageQuery($slug: String!) {
post(where: { slug: $slug }) {
title
date
content {
html
}
tags
author {
id
name
}
}
}
`
const variables ={
slug: context.page.params.slug,
}
const{ post }=await hygraph.request(query, variables)
return{
props:{
post,
},
}
}
</script>
<script>
exportlet post
</script>
<svelte:head>
<title>{post.title}</title>
</svelte:head>
<h1>{post.title}</h1>
<p>{post.author.name}</p>
<p>{post.date}</p>
<p>{post.tags}</p>
{@html post.content.html}
Take note of the last line here where I’m using the Svelte @html tag, this renders content with HTML in it.
Now I have a functional blog, not pretty, but functional.
Now to deploy this to Vercel! You're not bound to Vercel, you can use one of the SvelteKit adapters that are available.
npm i -D @sveltejs/adapter-vercel@next
Then I'll need to add that to the svelte.config file:
importvercelfrom'@sveltejs/adapter-vercel'
/** @type {import('@sveltejs/kit').Config} */
const config ={
kit:{
// hydrate the <div id="svelte"> element in src/app.html
target:'#svelte',
adapter:vercel(),
},
}
exportdefault config
Now to deploy to Vercel, I'll need the Vercel CLI installed, that's a global npm or Yarn install:
npm i -g vercel
# log into vercel
vc login
I'm prompted to verify the log in via email then I can use the CLI. I'll deploy with the vercel command from the terminal:
# run from the root of the project
vercel # or vc
I can go straight to production with this by using the --prod flag but before I do that I'll add the VITE_HYGRAPH_URL env value to the setting panel on the Vercel project page for what I've just deployed.
In the settings page of the Project, there's a section for "Environment Variables", the URL will be specific to your username and project name, it should look something like this:
In the Vercel UI for the Environment Variables, I'll add in the VITE_HYGRAPH_URL for the name and the Hygraph API endpoint for the value.
Now I can build again this time with the --prod flag:
vc --prod
That's it, I now have a functional blog in production! If you want to go ahead and style it yourself go for it! If you need a bit of direction on that I got you too!
Tailwind can be added to SvelteKit projects by using the svelte-add helper, there's loads to choose from in this case I'll be using it with JIT enabled:
# use svelte-add to install Tailwind
npx svelte-add tailwindcss --jit
# re-install dependencies
npm i
Tailwind will need the @tailwind directives so I'll create an app.css file in the src directory:
touch src/app.css
I'll add the base, components and utilities Tailwind directives to it:
@tailwind base;
@tailwind components;
@tailwind utilities;
Then I'll bring that into the layout, it could also be added directly to the src/app.html file as a link, in this instance I'll add it to the layout:
<script>
import'../app.css'
</script>
<nav>
<ahref="/">Home</a>
</nav>
<slot/>
Now onto adding the styles, I'm going to be using daisyUI which has a lot of pre-built components to use for scaffolding out a pretty decent UI quickly. I'm also going to use Tailwind Typography for styling the markdown.
npm i -D daisyui @tailwindcss/typography
Then add those to the Tailwind plugins array in the tailwind.config.cjs file:
I'm going to move the navigation out to its own component and import that into the layout, first up I'll create the lib folder, where component lives in SvelteKit:
mkdir src/lib
touch src/lib/nav.svelte
In the nav.svelte I'll add in one of the nav examples from daisyUI:
Same with the post page I'v amended the GraphQL query to bring back some additional data for the author image and the post tags; Here's what the query looks like:
queryPostPageQuery($slug:String!){
post(where:{slug:$slug}){
title
date
content{
html
}
tags
author{
name
title
picture{
fileName
url
}
}
coverImage{
fileName
url
}
}
}
I've added some Tailwind styles and brought in the author image. I'm also rendering out any tags if they're in the post data: