From 57efc611cd9f4d71a67ac2e875e774e8c4442ffd Mon Sep 17 00:00:00 2001 From: moris Date: Sun, 15 Dec 2024 20:16:48 +0900 Subject: [PATCH] =?UTF-8?q?change:=20dev=20build=20&=20publish=20false?= =?UTF-8?q?=E3=81=AE=E6=8A=95=E7=A8=BF=E3=81=AB=E7=9B=AE=E5=8D=B0=E3=82=92?= =?UTF-8?q?=E3=81=A4=E3=81=91=E3=82=8B=E3=81=AA=E3=81=A9=E3=82=92=E3=81=97?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/server/Metadatas.js | 5 +++-- src/routes/(DefaultStyle)/[slug]/+page.svelte | 8 +++++--- src/routes/feed.rss/+server.js | 20 +++++++++---------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/lib/server/Metadatas.js b/src/lib/server/Metadatas.js index cadec72..eb4055f 100644 --- a/src/lib/server/Metadatas.js +++ b/src/lib/server/Metadatas.js @@ -10,7 +10,6 @@ async function Metadatas() { const cache_dir = '/tmp/day.moris.blog/'; const cache_file = `${cache_dir}metadata.json`; - async function build() { const posts = await Posts(); @@ -20,9 +19,11 @@ async function Metadatas() { return {postId, metadata} })) - const sorted = metadataList.sort((a,b)=>{ + const sorted = metadataList + .sort((a,b)=>{ return b.metadata.date.getTime() - a.metadata.date.getTime() }) + .filter((m)=> dev||m.metadata.published) return sorted } diff --git a/src/routes/(DefaultStyle)/[slug]/+page.svelte b/src/routes/(DefaultStyle)/[slug]/+page.svelte index b2a34d0..9a0bc09 100644 --- a/src/routes/(DefaultStyle)/[slug]/+page.svelte +++ b/src/routes/(DefaultStyle)/[slug]/+page.svelte @@ -7,13 +7,11 @@
{#each data.posts as post} - {#if post.metadata.published} -
+
- {/if} {/each} {#if data.posts.length%4} {#each Array(4-data.posts.length%4) as i} @@ -48,6 +46,10 @@ border-radius: 8px; overflow: hidden; box-shadow: 0 0 6px #0001; + + &.published { + border: solid red 3px; + } } .paging { diff --git a/src/routes/feed.rss/+server.js b/src/routes/feed.rss/+server.js index 9f9ea8f..3f643ec 100644 --- a/src/routes/feed.rss/+server.js +++ b/src/routes/feed.rss/+server.js @@ -18,17 +18,15 @@ export async function GET() { let meta = post.metadata let link = `https://${PUBLIC_HOSTNAME}/blog/post/${path.basename(post.postId, '.md')}` - if (meta.published) { - i++ - items += ` - - ${meta.title} - ${meta.description} - ${link} - ${meta.date.toUTCString()} - ${link} - ` - } + i++ + items += ` + + ${meta.title} + ${meta.description} + ${link} + ${meta.date.toUTCString()} + ${link} + ` if (i==15) {break} }