From 9ca44ab2406c12e26d6d3a479abf73c5c77e36cf Mon Sep 17 00:00:00 2001 From: prokawsar Date: Tue, 5 Nov 2024 09:43:29 +0600 Subject: [PATCH] Enabled prerender on tap and optimize --- src/app.html | 2 +- src/routes/+layout.ts | 1 + src/routes/+page.server.ts | 5 +++-- src/routes/blog/+page.server.ts | 1 - svelte.config.js | 6 +++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/app.html b/src/app.html index c1524fb..4e27cbd 100644 --- a/src/app.html +++ b/src/app.html @@ -6,7 +6,7 @@ %sveltekit.head% - +
%sveltekit.body%
diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 1c7b50e..638abba 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -1,4 +1,5 @@ export const prerender = true +export const ssr = true export const load = async ({ url: { pathname } }) => { return { pathname } diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index d15904c..bc19464 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -2,9 +2,10 @@ import type { Blog } from '$utils/constants' import { getEntries } from '$utils/entries' import { error } from '@sveltejs/kit' -/** @type {import('./$types').PageServerLoad} */ -// export const prerender = 'auto' +export const prerender = true +export const ssr = true +/** @type {import('./$types').PageServerLoad} */ export async function load() { const posts: Blog[] = getEntries('posts') as Blog[] if (!posts) { diff --git a/src/routes/blog/+page.server.ts b/src/routes/blog/+page.server.ts index 90c0134..743a1bc 100644 --- a/src/routes/blog/+page.server.ts +++ b/src/routes/blog/+page.server.ts @@ -3,7 +3,6 @@ import { getEntries, getTags } from '$utils/entries' import { error } from '@sveltejs/kit' /** @type {import('./$types').PageServerLoad} */ -// export const prerender = 'auto' export async function load() { const posts = getEntries('posts') as Blog[] diff --git a/svelte.config.js b/svelte.config.js index 0d991d6..8f2d744 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -12,10 +12,10 @@ const config = { }), paths: { base: process.env.BASE_PATH || '' + }, + prerender: { + crawl: true } - // prerender: { - // handleHttpError: 'warn' - // } }, preprocess: [mdsvex(mdsvexConfig), vitePreprocess()] }