mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-04-30 11: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",
|
||||
"urara:build": "node urara.js build",
|
||||
"urara:watch": "node urara.js watch",
|
||||
"kit:dev": "export NODE_OPTIONS=--max_old_space_size=7680 && MODE=development vite dev",
|
||||
"kit:build": "export NODE_OPTIONS=--max_old_space_size=7680 && vite build",
|
||||
"kit:dev": "cross-env NODE_OPTIONS=--max_old_space_size=7680 MODE=development vite dev",
|
||||
"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": "npm-run-all -s tsc \"dev:parallel {@} \" --",
|
||||
"build": "npm-run-all -s tsc urara:build kit:build clean",
|
||||
|
@ -46,6 +46,7 @@
|
|||
"autoprefixer": "^10.4.7",
|
||||
"chalk": "^5.0.1",
|
||||
"chokidar": "^3.5.3",
|
||||
"cross-env": "^7.0.3",
|
||||
"cssnano": "^5.1.12",
|
||||
"daisyui": "^2.20.0",
|
||||
"eslint": "^8.21.0",
|
||||
|
|
|
@ -18,6 +18,7 @@ specifiers:
|
|||
autoprefixer: ^10.4.7
|
||||
chalk: ^5.0.1
|
||||
chokidar: ^3.5.3
|
||||
cross-env: ^7.0.3
|
||||
cssnano: ^5.1.12
|
||||
daisyui: ^2.20.0
|
||||
eslint: ^8.21.0
|
||||
|
@ -70,6 +71,7 @@ devDependencies:
|
|||
autoprefixer: 10.4.7_postcss@8.4.14
|
||||
chalk: 5.0.1
|
||||
chokidar: 3.5.3
|
||||
cross-env: 7.0.3
|
||||
cssnano: 5.1.12_postcss@8.4.14
|
||||
daisyui: 2.20.0_ugi4xkrfysqkt4c4y6hkyfj344
|
||||
eslint: 8.21.0
|
||||
|
@ -2416,6 +2418,14 @@ packages:
|
|||
semver: 7.0.0
|
||||
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:
|
||||
resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==}
|
||||
engines: {node: '>=4.8'}
|
||||
|
|
|
@ -10,31 +10,26 @@
|
|||
<meta property="og:locale" content={site.lang} />
|
||||
{#if post}
|
||||
<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="article:author" content={site.author.name} />
|
||||
<meta property="article:published_time" content={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}
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:image" content={maskable['512'].src ?? any['512'].src ?? any['192'].src} />
|
||||
|
@ -47,4 +42,4 @@
|
|||
<meta property="og:url" content={site.protocol + site.domain} />
|
||||
{/if}
|
||||
{/if}
|
||||
</svelte:head>
|
||||
</svelte:head>
|
|
@ -4,42 +4,41 @@ import { feed } from '$lib/config/general'
|
|||
import { favicon } from '$lib/config/icon'
|
||||
import { genPosts, genTags } from '$lib/utils/posts'
|
||||
|
||||
const render = async (posts = genPosts({ postHtml: true, postLimit: feed.limit, filterUnlisted: true })): Promise<string> =>
|
||||
`<?xml version="1.0" encoding="utf-8" ?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
const render = async (
|
||||
posts = genPosts({ postHtml: true, postLimit: feed.limit, filterUnlisted: true })
|
||||
): Promise<string> => `<?xml version='1.0' encoding='utf-8'?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<id>${site.protocol + site.domain}/</id>
|
||||
<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}/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>
|
||||
<author>
|
||||
<name><![CDATA[${site.author.name}]]></name>
|
||||
</author>${genTags(posts)
|
||||
.map(tag => `\n <category term="${tag}" scheme="${site.protocol + site.domain}/?tags=${encodeURI(tag)}" />`)
|
||||
.join('')}${posts
|
||||
.map(
|
||||
post => `\n <entry>
|
||||
.map(
|
||||
post => `\n <entry>
|
||||
<title type="html"><![CDATA[${post.title}]]></title>
|
||||
<link href="${site.protocol + site.domain + post.path}" />
|
||||
<id>${site.protocol + site.domain + post.path}</id>
|
||||
<published>${new Date(post.published ?? post.created).toJSON()}</published>
|
||||
<updated>${new Date(post.updated ?? post.published ?? post.created).toJSON()}</updated>${
|
||||
post.layout === 'article' && post.summary
|
||||
? `\n <summary type="html"><![CDATA[${post.summary.toString()}]]></summary>`
|
||||
: ''
|
||||
}
|
||||
post.summary ? `\n <summary type="html"><![CDATA[${post.summary.toString()}]]></summary>` : ''
|
||||
}
|
||||
<content type="html">
|
||||
<![CDATA[${post.html}]]>
|
||||
</content>${post.tags
|
||||
?.map(tag => `\n <category term="${tag}" scheme="${site.protocol + site.domain}/?tags=${encodeURI(tag)}" />`)
|
||||
.join('')}
|
||||
</entry>`
|
||||
)
|
||||
.join('')}
|
||||
)
|
||||
.join('')}
|
||||
</feed>`
|
||||
|
||||
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,
|
||||
tags: post.tags,
|
||||
_indieweb: {
|
||||
type: post.layout ?? 'article'
|
||||
type: post.type
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue