mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-04-30 21:59:30 +08:00
merge with 894b532
This commit is contained in:
parent
a83280d7c7
commit
2aa93f55f8
4 changed files with 13 additions and 13 deletions
7
src/hooks.ts
Normal file
7
src/hooks.ts
Normal 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'}">`)
|
||||||
|
})
|
|
@ -1,4 +1,5 @@
|
||||||
import type { RequestHandler } from './$types'
|
import type { RequestHandler } from './$types'
|
||||||
|
import { json } from '@sveltejs/kit'
|
||||||
import { site } from '$lib/config/site'
|
import { site } from '$lib/config/site'
|
||||||
import { feed } from '$lib/config/general'
|
import { feed } from '$lib/config/general'
|
||||||
import { favicon, any } from '$lib/config/icon'
|
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 prerender = true
|
||||||
export const GET: RequestHandler = async () =>
|
export const GET: RequestHandler = async () =>
|
||||||
new Response(JSON.stringify(render(), null, 2), {
|
json(render(), {
|
||||||
headers: {
|
headers: {
|
||||||
'content-type': 'application/feed+json; charset=utf-8'
|
'content-type': 'application/feed+json; charset=utf-8'
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
import type { RequestHandler } from './$types'
|
import type { RequestHandler } from './$types'
|
||||||
|
import { json } from '@sveltejs/kit'
|
||||||
import { genPosts } from '$lib/utils/posts'
|
import { genPosts } from '$lib/utils/posts'
|
||||||
|
|
||||||
export const prerender = true
|
export const prerender = true
|
||||||
export const GET: RequestHandler = async () =>
|
export const GET: RequestHandler = async () => json(genPosts())
|
||||||
new Response(JSON.stringify(genPosts(), null, 2), {
|
|
||||||
headers: {
|
|
||||||
'content-type': 'application/json; charset=utf-8'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
import type { RequestHandler } from './$types'
|
import type { RequestHandler } from './$types'
|
||||||
|
import { json } from '@sveltejs/kit'
|
||||||
import { genPosts, genTags } from '$lib/utils/posts'
|
import { genPosts, genTags } from '$lib/utils/posts'
|
||||||
|
|
||||||
export const prerender = true
|
export const prerender = true
|
||||||
export const GET: RequestHandler = async () =>
|
export const GET: RequestHandler = async () => json(genTags(genPosts()))
|
||||||
new Response(JSON.stringify(genTags(genPosts()), null, 2), {
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json; charset=utf-8'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
Loading…
Reference in a new issue