change: dev build & publish falseの投稿に目印をつけるなどをした

This commit is contained in:
moris 2024-12-15 20:16:48 +09:00
parent d22b5cfc6f
commit 57efc611cd
3 changed files with 17 additions and 16 deletions

View File

@ -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
}

View File

@ -7,13 +7,11 @@
<div class='contain'>
<div class="posts">
{#each data.posts as post}
{#if post.metadata.published}
<div class="post">
<div class="post" class:published={!post.metadata.published}>
<a style='text-decoration: none;' href="../post/{post.postId}" tabindex="0">
<Postgrid id={post.postId} {...post.metadata}></Postgrid>
</a>
</div>
{/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 {

View File

@ -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 += `
<item>
<title>${meta.title}</title>
<description>${meta.description}</description>
<link>${link}</link>
<pubDate>${meta.date.toUTCString()}</pubDate>
<guid>${link}</guid>
</item>`
}
i++
items += `
<item>
<title>${meta.title}</title>
<description>${meta.description}</description>
<link>${link}</link>
<pubDate>${meta.date.toUTCString()}</pubDate>
<guid>${link}</guid>
</item>`
if (i==15) {break}
}