diff options
author | 2022-03-28 17:16:06 -0700 | |
---|---|---|
committer | 2022-03-28 17:16:06 -0700 | |
commit | 4299ab303b0743349fbd01f85340bea61a1c16a8 (patch) | |
tree | 7012176c704d4f254fb2a602101fb7f0a01b8450 /examples/blog-multiple-authors/src/components/PostPreview.astro | |
parent | 7d29feace103c0cf7c682634d4359b69338c2a1d (diff) | |
download | astro-4299ab303b0743349fbd01f85340bea61a1c16a8.tar.gz astro-4299ab303b0743349fbd01f85340bea61a1c16a8.tar.zst astro-4299ab303b0743349fbd01f85340bea61a1c16a8.zip |
New Markdown API (#2862)
* Implement new markdown plugin with deferred markdown rendering
* feat: switch from `getContent()` fn to `<Content />` API
* update types
* Update packages/astro/src/@types/astro.ts
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
* update types
* Create forty-coins-attend.md
Co-authored-by: Nate Moore <nate@skypack.dev>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Diffstat (limited to 'examples/blog-multiple-authors/src/components/PostPreview.astro')
-rw-r--r-- | examples/blog-multiple-authors/src/components/PostPreview.astro | 11 |
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> |