From 130e39ef4838f0faba148c4a64d65f5030f64ac8 Mon Sep 17 00:00:00 2001 From: Sevichecc <91365763+Sevichecc@users.noreply.github.com> Date: Fri, 12 Aug 2022 00:28:08 +0800 Subject: [PATCH] merge to the latest --- package.json | 5 +-- pnpm-lock.yaml | 10 ++++++ src/lib/components/head_opengraph.svelte | 39 +++++++++++------------- src/routes/atom.xml.ts | 29 +++++++++--------- src/routes/feed.json.ts | 2 +- 5 files changed, 45 insertions(+), 40 deletions(-) diff --git a/package.json b/package.json index f3850081..2c3db490 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 28f483f2..e431af90 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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'} diff --git a/src/lib/components/head_opengraph.svelte b/src/lib/components/head_opengraph.svelte index d3f17f64..7e0bfc09 100644 --- a/src/lib/components/head_opengraph.svelte +++ b/src/lib/components/head_opengraph.svelte @@ -10,31 +10,26 @@ {#if post} + + {#if post.summary} + + {/if} + {#if post.image} + + + {:else} + + + {/if} + {#if post.tags} + {#each post.tags as tag} + + {/each} + {/if} - {#if post.layout === 'article'} - - - {#if post.summary} - - {/if} - {#if post.image} - - - {:else} - - - {/if} - {#if post.tags} - {#each post.tags as tag} - - {/each} - {/if} - {:else if post.layout === 'note'} - - {/if} {:else} @@ -47,4 +42,4 @@ {/if} {/if} - + \ No newline at end of file diff --git a/src/routes/atom.xml.ts b/src/routes/atom.xml.ts index 380120dc..3b961d96 100644 --- a/src/routes/atom.xml.ts +++ b/src/routes/atom.xml.ts @@ -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 => - ` - +const render = async ( + posts = genPosts({ postHtml: true, postLimit: feed.limit, filterUnlisted: true }) +): Promise => ` + ${site.protocol + site.domain}/ <![CDATA[${site.title}]]>${site.subtitle ? `\n ` : ''}${ - favicon ? `\n ${favicon.src}` : '' - } + favicon ? `\n ${favicon.src}` : '' +} ${ - feed.hubs?.map(hub => `\n `).join('') ?? '' - } + feed.hubs?.map(hub => `\n `).join('') ?? '' +} ${new Date().toJSON()} ${genTags(posts) .map(tag => `\n `) .join('')}${posts - .map( - post => `\n + .map( + post => `\n <![CDATA[${post.title}]]> ${site.protocol + site.domain + post.path} ${new Date(post.published ?? post.created).toJSON()} ${new Date(post.updated ?? post.published ?? post.created).toJSON()}${ - post.layout === 'article' && post.summary - ? `\n ` - : '' - } + post.summary ? `\n ` : '' + } ${post.tags ?.map(tag => `\n `) .join('')} ` - ) - .join('')} + ) + .join('')} ` export const GET: RequestHandler = async () => ({ diff --git a/src/routes/feed.json.ts b/src/routes/feed.json.ts index 56237ae7..66809ebc 100644 --- a/src/routes/feed.json.ts +++ b/src/routes/feed.json.ts @@ -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 } })) })