Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbloxhub committed Jul 24, 2023
1 parent c39c215 commit c8671dc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
7 changes: 5 additions & 2 deletions src/components/BlogPost.astro
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
const { title, url, pubDate, renderPromise } = Astro.props
const { title, url, pubDate, description, renderPromise } = Astro.props
const { remarkPluginFrontmatter } = await renderPromise
---

<li>
<a href={url}>{title}</a> <br />
Approximately {remarkPluginFrontmatter.minutesRead}, published {pubDate.toISOString().slice(0,10)}
<span>
{description} <br />
Approximately {remarkPluginFrontmatter.minutesRead}, published {pubDate.toISOString().slice(0,10)}
</span>
</li>
3 changes: 1 addition & 2 deletions src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ const blogCollection = defineCollection({
title: z.string(),
pubDate: z.date(),
description: z.string(),
author: z.string(),
minutesRead: z.string().optional()
author: z.string()
})
})

Expand Down
11 changes: 7 additions & 4 deletions src/layouts/MarkdownPostLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ const { frontmatter, remarkPluginFrontmatter } = Astro.props
<Layout title={frontmatter.title}>
<main class="m-auto p-6 max-w-6xl text-left">
<h1>{frontmatter.title}</h1>
<p>Written by {frontmatter.author}</p>
<p>Published on {frontmatter.pubDate.toISOString().slice(0,10)}</p>
<p>Approximately {remarkPluginFrontmatter.minutesRead}</p>
<slot />
<span class="text-sm">
Written by {frontmatter.author}, Published on {frontmatter.pubDate.toISOString().slice(0,10)} <br />
Approximately {remarkPluginFrontmatter.minutesRead} <br />
</span>
<span class="text-xl">
<slot />
</span>
</main>
</Layout>
2 changes: 1 addition & 1 deletion src/pages/blog.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const pageTitle = "bitbloxhub's blog"
<main class="m-auto p-6 max-w-6xl text-left">
<h1>bitbloxhub's blog!</h1>
<ul class="text-base">
{allPosts.map((post) => <BlogPost url={`/posts/${post.slug}/`} title={post.data.title} pubDate={post.data.pubDate} renderPromise={post.render()} />)}
{allPosts.map((post) => <BlogPost url={`/posts/${post.slug}/`} description={post.data.description} title={post.data.title} pubDate={post.data.pubDate} renderPromise={post.render()} />)}
</ul>
</main>
</Layout>

0 comments on commit c8671dc

Please sign in to comment.