merge with 894b532

This commit is contained in:
sevichecc 2022-09-10 11:13:07 +08:00
parent a83280d7c7
commit 2aa93f55f8
4 changed files with 13 additions and 13 deletions

7
src/hooks.ts Normal file
View file

@ -0,0 +1,7 @@
import type { Handle } from '@sveltejs/kit'
import { site } from '$lib/config/site'
export const handle: Handle = async ({ event, resolve }) =>
await resolve(event, {
transformPageChunk: ({ html }) => html.replace('<html lang="en">', `<html lang="${site.lang ?? 'en'}">`)
})

View file

@ -1,4 +1,5 @@
import type { RequestHandler } from './$types'
import { json } from '@sveltejs/kit'
import { site } from '$lib/config/site'
import { feed } from '$lib/config/general'
import { favicon, any } from '$lib/config/icon'
@ -43,7 +44,7 @@ const render = (posts = genPosts({ postHtml: true, postLimit: feed.limit, filter
export const prerender = true
export const GET: RequestHandler = async () =>
new Response(JSON.stringify(render(), null, 2), {
json(render(), {
headers: {
'content-type': 'application/feed+json; charset=utf-8'
}

View file

@ -1,10 +1,6 @@
import type { RequestHandler } from './$types'
import { json } from '@sveltejs/kit'
import { genPosts } from '$lib/utils/posts'
export const prerender = true
export const GET: RequestHandler = async () =>
new Response(JSON.stringify(genPosts(), null, 2), {
headers: {
'content-type': 'application/json; charset=utf-8'
}
})
export const GET: RequestHandler = async () => json(genPosts())

View file

@ -1,10 +1,6 @@
import type { RequestHandler } from './$types'
import { json } from '@sveltejs/kit'
import { genPosts, genTags } from '$lib/utils/posts'
export const prerender = true
export const GET: RequestHandler = async () =>
new Response(JSON.stringify(genTags(genPosts()), null, 2), {
headers: {
'Content-Type': 'application/json; charset=utf-8'
}
})
export const GET: RequestHandler = async () => json(genTags(genPosts()))