Get feed to work again Without any breaking changes
This commit is contained in:
parent
b3153ae06a
commit
236ac565f7
@ -7,7 +7,6 @@ import { getBlogListing } from '../../content'
|
|||||||
import type { RequestHandler } from './$types'
|
import type { RequestHandler } from './$types'
|
||||||
|
|
||||||
export const GET = (async ({ params }) => {
|
export const GET = (async ({ params }) => {
|
||||||
console.log('article-params', params)
|
|
||||||
const handledParams = params.params === 'index' ? '' : params.params
|
const handledParams = params.params === 'index' ? '' : params.params
|
||||||
const { page = 1, pageSize = 7, ...filters } = parseParams(handledParams)
|
const { page = 1, pageSize = 7, ...filters } = parseParams(handledParams)
|
||||||
const paginationParams = getDropTakeFromPageParams(
|
const paginationParams = getDropTakeFromPageParams(
|
||||||
|
12
src/routes/feed.json/+server.ts
Normal file
12
src/routes/feed.json/+server.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import type { RequestHandler } from '@sveltejs/kit'
|
||||||
|
import { getFeed } from '../feed'
|
||||||
|
|
||||||
|
export const GET = (async ({ setHeaders }) => {
|
||||||
|
const feed = await getFeed()
|
||||||
|
|
||||||
|
setHeaders({
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Cache-Control': 'max-age=86400',
|
||||||
|
})
|
||||||
|
return new Response(feed.json1())
|
||||||
|
}) satisfies RequestHandler
|
@ -1,5 +1,5 @@
|
|||||||
import { Feed } from 'feed'
|
import { Feed } from 'feed'
|
||||||
import { getBlogListing } from '../blog/content'
|
import { getBlogListing } from './blog/content'
|
||||||
|
|
||||||
export async function getFeed() {
|
export async function getFeed() {
|
||||||
const feed = new Feed({
|
const feed = new Feed({
|
12
src/routes/feed.xml/+server.ts
Normal file
12
src/routes/feed.xml/+server.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import type { RequestHandler } from '@sveltejs/kit'
|
||||||
|
import { getFeed } from '../feed'
|
||||||
|
|
||||||
|
export const GET = (async ({ setHeaders }) => {
|
||||||
|
const feed = await getFeed()
|
||||||
|
|
||||||
|
setHeaders({
|
||||||
|
'Content-Type': 'application/xml',
|
||||||
|
'Cache-Control': 'max-age=86400',
|
||||||
|
})
|
||||||
|
return new Response(feed.rss2())
|
||||||
|
}) satisfies RequestHandler
|
@ -1,10 +0,0 @@
|
|||||||
import { getFeed } from './_feed'
|
|
||||||
|
|
||||||
export async function get() {
|
|
||||||
const feed = await getFeed()
|
|
||||||
|
|
||||||
return {
|
|
||||||
status: 200,
|
|
||||||
body: feed.json1(),
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
import { getFeed } from './_feed'
|
|
||||||
|
|
||||||
export async function get(req, res) {
|
|
||||||
const feed = await getFeed()
|
|
||||||
|
|
||||||
return {
|
|
||||||
status: 200,
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/xml',
|
|
||||||
},
|
|
||||||
body: feed.rss2(),
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user