feat: add summary field in articles
This commit is contained in:
parent
74a8bbc72a
commit
0eef3d8d05
3 changed files with 13 additions and 4 deletions
|
@ -1,8 +1,10 @@
|
|||
import { z, reference } from 'astro:content';
|
||||
|
||||
// @ts-ignore
|
||||
export const posts = ({ image }) => z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
summary: z.string().optional(),
|
||||
pubDate: z.coerce.date(),
|
||||
updatedDate: z.coerce.date().optional(),
|
||||
categories: z.array(z.string()).default(['uncategorized']),
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: 'The Art of Minimalism'
|
||||
description: 'Thoughts on minimalism in design and code'
|
||||
summary: 'Exploring the principles of minimalism and its application in design and coding practices.'
|
||||
pubDate: '2025-06-05'
|
||||
author: 'Wheatley'
|
||||
tags:
|
||||
|
|
|
@ -52,9 +52,10 @@ const cover = customFeaturedImage || matchedImage_src?.src || firstImageURL || `
|
|||
<h1 class="title">{entry.data.title}</h1>
|
||||
<AuthorInfo data={authorData} />
|
||||
<span class="date">{new Date(entry.data.pubDate).toISOString().split('T')[0]}</span>
|
||||
{headings.length !== 0 && <TableOfContents headings={headings} />}
|
||||
{headings.length !== 0 && <TableOfContents headings={headings} />}
|
||||
{entry.data.summary && <p class="summary">{entry.data.summary}</p> }
|
||||
<div class="content">
|
||||
<Content />
|
||||
<Content />
|
||||
</div>
|
||||
|
||||
<div class="extra-post" style="margin-top: 2rem; border-top: 1px solid var(--border-color); padding-top: 1rem;">
|
||||
|
@ -68,6 +69,11 @@ const cover = customFeaturedImage || matchedImage_src?.src || firstImageURL || `
|
|||
</script>
|
||||
}
|
||||
</div>
|
||||
|
||||
</Layout>
|
||||
|
||||
<style>
|
||||
p.summary {
|
||||
font-style: italic;
|
||||
color: var(--secondary-text-color);
|
||||
margin: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue