summaryrefslogtreecommitdiff
path: root/examples/blog-multiple-authors/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'examples/blog-multiple-authors/src/components')
-rw-r--r--examples/blog-multiple-authors/src/components/PostPreview.astro11
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/blog-multiple-authors/src/components/PostPreview.astro b/examples/blog-multiple-authors/src/components/PostPreview.astro
index 81e80ba6c..5a9808348 100644
--- a/examples/blog-multiple-authors/src/components/PostPreview.astro
+++ b/examples/blog-multiple-authors/src/components/PostPreview.astro
@@ -4,6 +4,7 @@ export interface Props {
author: string;
}
const { post, author } = Astro.props;
+const { frontmatter } = post;
function formatDate(date) {
return new Date(date).toUTCString().replace(/(\d\d\d\d) .*/, '$1'); // remove everything after YYYY
@@ -12,12 +13,12 @@ function formatDate(date) {
<article class="post">
<div class="data">
- <h2>{post.title}</h2>
- <a class="author" href={`/authors/${post.author}`}>{author.name}</a>
- <time class="date" datetime={post.date}>{formatDate(post.date)}</time>
+ <h2>{frontmatter.title}</h2>
+ <a class="author" href={`/authors/${frontmatter.author}`}>{author.name}</a>
+ <time class="date" datetime={frontmatter.date}>{formatDate(frontmatter.date)}</time>
<p class="description">
- {post.description}
- <a class="link" href={post.url} aria-label={`Read ${post.title}`}>Read</a>
+ {frontmatter.description}
+ <a class="link" href={post.url} aria-label={`Read ${frontmatter.title}`}>Read</a>
</p>
</div>
</article>