Skip to content

Commit

Permalink
Enabled prerender on tap and optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
prokawsar committed Nov 5, 2024
1 parent fcd5d56 commit 9ca44ab
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<body data-sveltekit-preload-data="tap">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
1 change: 1 addition & 0 deletions src/routes/+layout.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const prerender = true
export const ssr = true

export const load = async ({ url: { pathname } }) => {
return { pathname }
Expand Down
5 changes: 3 additions & 2 deletions src/routes/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion src/routes/blog/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand Down
6 changes: 3 additions & 3 deletions svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const config = {
}),
paths: {
base: process.env.BASE_PATH || ''
},
prerender: {
crawl: true
}
// prerender: {
// handleHttpError: 'warn'
// }
},
preprocess: [mdsvex(mdsvexConfig), vitePreprocess()]
}
Expand Down

0 comments on commit 9ca44ab

Please sign in to comment.