mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-04-30 14:29:29 +08:00
merge to the latest
This commit is contained in:
parent
444eca8bd1
commit
130e39ef48
5 changed files with 45 additions and 40 deletions
|
@ -12,8 +12,8 @@
|
||||||
"tsc:watch": "tsc -w -p tsconfig.node.json",
|
"tsc:watch": "tsc -w -p tsconfig.node.json",
|
||||||
"urara:build": "node urara.js build",
|
"urara:build": "node urara.js build",
|
||||||
"urara:watch": "node urara.js watch",
|
"urara:watch": "node urara.js watch",
|
||||||
"kit:dev": "export NODE_OPTIONS=--max_old_space_size=7680 && MODE=development vite dev",
|
"kit:dev": "cross-env NODE_OPTIONS=--max_old_space_size=7680 MODE=development vite dev",
|
||||||
"kit:build": "export NODE_OPTIONS=--max_old_space_size=7680 && vite build",
|
"kit:build": "cross-env NODE_OPTIONS=--max_old_space_size=7680 vite build",
|
||||||
"dev:parallel": "npm-run-all -p -r tsc:watch urara:watch \"kit:dev {@} \" --",
|
"dev:parallel": "npm-run-all -p -r tsc:watch urara:watch \"kit:dev {@} \" --",
|
||||||
"dev": "npm-run-all -s tsc \"dev:parallel {@} \" --",
|
"dev": "npm-run-all -s tsc \"dev:parallel {@} \" --",
|
||||||
"build": "npm-run-all -s tsc urara:build kit:build clean",
|
"build": "npm-run-all -s tsc urara:build kit:build clean",
|
||||||
|
@ -46,6 +46,7 @@
|
||||||
"autoprefixer": "^10.4.7",
|
"autoprefixer": "^10.4.7",
|
||||||
"chalk": "^5.0.1",
|
"chalk": "^5.0.1",
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
"cssnano": "^5.1.12",
|
"cssnano": "^5.1.12",
|
||||||
"daisyui": "^2.20.0",
|
"daisyui": "^2.20.0",
|
||||||
"eslint": "^8.21.0",
|
"eslint": "^8.21.0",
|
||||||
|
|
|
@ -18,6 +18,7 @@ specifiers:
|
||||||
autoprefixer: ^10.4.7
|
autoprefixer: ^10.4.7
|
||||||
chalk: ^5.0.1
|
chalk: ^5.0.1
|
||||||
chokidar: ^3.5.3
|
chokidar: ^3.5.3
|
||||||
|
cross-env: ^7.0.3
|
||||||
cssnano: ^5.1.12
|
cssnano: ^5.1.12
|
||||||
daisyui: ^2.20.0
|
daisyui: ^2.20.0
|
||||||
eslint: ^8.21.0
|
eslint: ^8.21.0
|
||||||
|
@ -70,6 +71,7 @@ devDependencies:
|
||||||
autoprefixer: 10.4.7_postcss@8.4.14
|
autoprefixer: 10.4.7_postcss@8.4.14
|
||||||
chalk: 5.0.1
|
chalk: 5.0.1
|
||||||
chokidar: 3.5.3
|
chokidar: 3.5.3
|
||||||
|
cross-env: 7.0.3
|
||||||
cssnano: 5.1.12_postcss@8.4.14
|
cssnano: 5.1.12_postcss@8.4.14
|
||||||
daisyui: 2.20.0_ugi4xkrfysqkt4c4y6hkyfj344
|
daisyui: 2.20.0_ugi4xkrfysqkt4c4y6hkyfj344
|
||||||
eslint: 8.21.0
|
eslint: 8.21.0
|
||||||
|
@ -2416,6 +2418,14 @@ packages:
|
||||||
semver: 7.0.0
|
semver: 7.0.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/cross-env/7.0.3:
|
||||||
|
resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==}
|
||||||
|
engines: {node: '>=10.14', npm: '>=6', yarn: '>=1'}
|
||||||
|
hasBin: true
|
||||||
|
dependencies:
|
||||||
|
cross-spawn: 7.0.3
|
||||||
|
dev: true
|
||||||
|
|
||||||
/cross-spawn/6.0.5:
|
/cross-spawn/6.0.5:
|
||||||
resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==}
|
resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==}
|
||||||
engines: {node: '>=4.8'}
|
engines: {node: '>=4.8'}
|
||||||
|
|
|
@ -10,31 +10,26 @@
|
||||||
<meta property="og:locale" content={site.lang} />
|
<meta property="og:locale" content={site.lang} />
|
||||||
{#if post}
|
{#if post}
|
||||||
<meta property="og:type" content="article" />
|
<meta property="og:type" content="article" />
|
||||||
|
<meta property="og:title" content={post.title ?? post.summary ?? post.path.slice(1)} />
|
||||||
|
{#if post.summary}
|
||||||
|
<meta property="og:description" content={post.summary} />
|
||||||
|
{/if}
|
||||||
|
{#if post.image}
|
||||||
|
<meta property="og:image" content={site.protocol + site.domain + post.image} />
|
||||||
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
|
{:else}
|
||||||
|
<meta property="og:image" content={maskable['512'].src ?? any['512'].src ?? any['192'].src} />
|
||||||
|
<meta name="twitter:card" content="summary" />
|
||||||
|
{/if}
|
||||||
|
{#if post.tags}
|
||||||
|
{#each post.tags as tag}
|
||||||
|
<meta property="article:tag" content={tag} />
|
||||||
|
{/each}
|
||||||
|
{/if}
|
||||||
<meta property="og:url" content={site.protocol + site.domain + post.path} />
|
<meta property="og:url" content={site.protocol + site.domain + post.path} />
|
||||||
<meta property="article:author" content={site.author.name} />
|
<meta property="article:author" content={site.author.name} />
|
||||||
<meta property="article:published_time" content={post.published ?? post.created} />
|
<meta property="article:published_time" content={post.published ?? post.created} />
|
||||||
<meta property="article:modified_time" content={post.updated ?? post.published ?? post.created} />
|
<meta property="article:modified_time" content={post.updated ?? post.published ?? post.created} />
|
||||||
{#if post.layout === 'article'}
|
|
||||||
<meta property="og:title" content={post.title ?? post.path.slice(1)} />
|
|
||||||
<meta property="og:url" content={site.protocol + site.domain + post.path} />
|
|
||||||
{#if post.summary}
|
|
||||||
<meta property="og:description" content={post.summary} />
|
|
||||||
{/if}
|
|
||||||
{#if post.image}
|
|
||||||
<meta property="og:image" content={site.protocol + site.domain + post.image} />
|
|
||||||
<meta name="twitter:card" content="summary_large_image" />
|
|
||||||
{:else}
|
|
||||||
<meta property="og:image" content={maskable['512'].src ?? any['512'].src ?? any['192'].src} />
|
|
||||||
<meta name="twitter:card" content="summary" />
|
|
||||||
{/if}
|
|
||||||
{#if post.tags}
|
|
||||||
{#each post.tags as tag}
|
|
||||||
<meta property="article:tag" content={tag} />
|
|
||||||
{/each}
|
|
||||||
{/if}
|
|
||||||
{:else if post.layout === 'note'}
|
|
||||||
<meta property="og:title" content={post.path} />
|
|
||||||
{/if}
|
|
||||||
{:else}
|
{:else}
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:image" content={maskable['512'].src ?? any['512'].src ?? any['192'].src} />
|
<meta property="og:image" content={maskable['512'].src ?? any['512'].src ?? any['192'].src} />
|
||||||
|
|
|
@ -4,42 +4,41 @@ import { feed } from '$lib/config/general'
|
||||||
import { favicon } from '$lib/config/icon'
|
import { favicon } from '$lib/config/icon'
|
||||||
import { genPosts, genTags } from '$lib/utils/posts'
|
import { genPosts, genTags } from '$lib/utils/posts'
|
||||||
|
|
||||||
const render = async (posts = genPosts({ postHtml: true, postLimit: feed.limit, filterUnlisted: true })): Promise<string> =>
|
const render = async (
|
||||||
`<?xml version="1.0" encoding="utf-8" ?>
|
posts = genPosts({ postHtml: true, postLimit: feed.limit, filterUnlisted: true })
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
): Promise<string> => `<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||||
<id>${site.protocol + site.domain}/</id>
|
<id>${site.protocol + site.domain}/</id>
|
||||||
<title><![CDATA[${site.title}]]></title>${site.subtitle ? `\n <subtitle><![CDATA[${site.subtitle}]]></subtitle>` : ''}${
|
<title><![CDATA[${site.title}]]></title>${site.subtitle ? `\n <subtitle><![CDATA[${site.subtitle}]]></subtitle>` : ''}${
|
||||||
favicon ? `\n <icon>${favicon.src}</icon>` : ''
|
favicon ? `\n <icon>${favicon.src}</icon>` : ''
|
||||||
}
|
}
|
||||||
<link href="${site.protocol + site.domain}" />
|
<link href="${site.protocol + site.domain}" />
|
||||||
<link href="${site.protocol + site.domain}/atom.xml" rel="self" type="application/atom+xml" />${
|
<link href="${site.protocol + site.domain}/atom.xml" rel="self" type="application/atom+xml" />${
|
||||||
feed.hubs?.map(hub => `\n <link href="${hub}" rel="hub"/>`).join('') ?? ''
|
feed.hubs?.map(hub => `\n <link href="${hub}" rel="hub"/>`).join('') ?? ''
|
||||||
}
|
}
|
||||||
<updated>${new Date().toJSON()}</updated>
|
<updated>${new Date().toJSON()}</updated>
|
||||||
<author>
|
<author>
|
||||||
<name><![CDATA[${site.author.name}]]></name>
|
<name><![CDATA[${site.author.name}]]></name>
|
||||||
</author>${genTags(posts)
|
</author>${genTags(posts)
|
||||||
.map(tag => `\n <category term="${tag}" scheme="${site.protocol + site.domain}/?tags=${encodeURI(tag)}" />`)
|
.map(tag => `\n <category term="${tag}" scheme="${site.protocol + site.domain}/?tags=${encodeURI(tag)}" />`)
|
||||||
.join('')}${posts
|
.join('')}${posts
|
||||||
.map(
|
.map(
|
||||||
post => `\n <entry>
|
post => `\n <entry>
|
||||||
<title type="html"><![CDATA[${post.title}]]></title>
|
<title type="html"><![CDATA[${post.title}]]></title>
|
||||||
<link href="${site.protocol + site.domain + post.path}" />
|
<link href="${site.protocol + site.domain + post.path}" />
|
||||||
<id>${site.protocol + site.domain + post.path}</id>
|
<id>${site.protocol + site.domain + post.path}</id>
|
||||||
<published>${new Date(post.published ?? post.created).toJSON()}</published>
|
<published>${new Date(post.published ?? post.created).toJSON()}</published>
|
||||||
<updated>${new Date(post.updated ?? post.published ?? post.created).toJSON()}</updated>${
|
<updated>${new Date(post.updated ?? post.published ?? post.created).toJSON()}</updated>${
|
||||||
post.layout === 'article' && post.summary
|
post.summary ? `\n <summary type="html"><![CDATA[${post.summary.toString()}]]></summary>` : ''
|
||||||
? `\n <summary type="html"><![CDATA[${post.summary.toString()}]]></summary>`
|
}
|
||||||
: ''
|
|
||||||
}
|
|
||||||
<content type="html">
|
<content type="html">
|
||||||
<![CDATA[${post.html}]]>
|
<![CDATA[${post.html}]]>
|
||||||
</content>${post.tags
|
</content>${post.tags
|
||||||
?.map(tag => `\n <category term="${tag}" scheme="${site.protocol + site.domain}/?tags=${encodeURI(tag)}" />`)
|
?.map(tag => `\n <category term="${tag}" scheme="${site.protocol + site.domain}/?tags=${encodeURI(tag)}" />`)
|
||||||
.join('')}
|
.join('')}
|
||||||
</entry>`
|
</entry>`
|
||||||
)
|
)
|
||||||
.join('')}
|
.join('')}
|
||||||
</feed>`
|
</feed>`
|
||||||
|
|
||||||
export const GET: RequestHandler = async () => ({
|
export const GET: RequestHandler = async () => ({
|
||||||
|
|
|
@ -35,7 +35,7 @@ const render = async (posts = genPosts({ postHtml: true, postLimit: feed.limit,
|
||||||
date_modified: post.updated ?? post.published ?? post.created,
|
date_modified: post.updated ?? post.published ?? post.created,
|
||||||
tags: post.tags,
|
tags: post.tags,
|
||||||
_indieweb: {
|
_indieweb: {
|
||||||
type: post.layout ?? 'article'
|
type: post.type
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue