lint
This commit is contained in:
parent
c7d48b3d96
commit
37880d297b
|
@ -4,49 +4,51 @@ 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'
|
||||||
import { genPosts } from '$lib/utils/posts'
|
import { genPosts } from '$lib/utils/posts'
|
||||||
|
import readingTime from 'reading-time'
|
||||||
|
|
||||||
const render = (posts = genPosts({ postHtml: true, postLimit: feed.limit, filterUnlisted: true })) => ({
|
const render = (posts = genPosts({ postHtml: true, postLimit: feed.limit, filterUnlisted: true })) => ({
|
||||||
version: 'https://jsonfeed.org/version/1.1',
|
version: 'https://jsonfeed.org/version/1.1',
|
||||||
title: site.title,
|
title: site.title,
|
||||||
home_page_url: site.protocol + site.domain,
|
home_page_url: site.protocol + site.domain,
|
||||||
feed_url: site.protocol + site.domain + '/feed.json',
|
feed_url: site.protocol + site.domain + '/feed.json',
|
||||||
description: site.description,
|
description: site.description,
|
||||||
icon: any['512'].src ?? any['192'].src,
|
icon: any['512'].src ?? any['192'].src,
|
||||||
favicon: favicon?.src,
|
favicon: favicon?.src,
|
||||||
authors: [
|
authors: [
|
||||||
{
|
{
|
||||||
name: site.author.name,
|
name: site.author.name,
|
||||||
url: site.protocol + site.domain,
|
url: site.protocol + site.domain,
|
||||||
avatar: site.author.avatar
|
avatar: site.author.avatar
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
language: site.lang ?? 'en',
|
language: site.lang ?? 'en',
|
||||||
hubs: feed.hubs?.map(hub => ({
|
hubs: feed.hubs?.map(hub => ({
|
||||||
type: 'WebSub',
|
type: 'WebSub',
|
||||||
url: hub
|
url: hub
|
||||||
})),
|
})),
|
||||||
items: posts.map(post => ({
|
items: posts.map(post => ({
|
||||||
id: post.path.slice(1),
|
id: post.path.slice(1),
|
||||||
url: site.protocol + site.domain + post.path,
|
url: site.protocol + site.domain + post.path,
|
||||||
title: post.title,
|
title: post.title,
|
||||||
content_html: post.html,
|
content_html: post.html,
|
||||||
summary: post['summary'],
|
summary: post['summary'],
|
||||||
image: post['image'],
|
readingTime,
|
||||||
date_published: post.published ?? post.created,
|
image: post['image'],
|
||||||
date_modified: post.updated ?? post.published ?? post.created,
|
date_published: post.published ?? post.created,
|
||||||
tags: post.tags,
|
date_modified: post.updated ?? post.published ?? post.created,
|
||||||
_indieweb: {
|
tags: post.tags,
|
||||||
type: post.type,
|
_indieweb: {
|
||||||
'in-reply-to': post.in_reply_to
|
type: post.type,
|
||||||
}
|
'in-reply-to': post.in_reply_to
|
||||||
}))
|
}
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
export const prerender = true
|
export const prerender = true
|
||||||
export const trailingSlash = 'never'
|
export const trailingSlash = 'never'
|
||||||
export const GET: RequestHandler = async () =>
|
export const GET: RequestHandler = async () =>
|
||||||
json(render(), {
|
json(render(), {
|
||||||
headers: {
|
headers: {
|
||||||
'content-type': 'application/feed+json; charset=utf-8'
|
'content-type': 'application/feed+json; charset=utf-8'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue