Show excerpt under tags in article lists
This commit is contained in:
@@ -12,6 +12,9 @@ export function PostListItem({ post }: Props) {
|
|||||||
? post.feature_image.replace('../assets', '/assets')
|
? post.feature_image.replace('../assets', '/assets')
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
const excerpt =
|
||||||
|
post.description || post.custom_excerpt || post.body?.raw?.slice(0, 120);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
<Link href={post.url}>
|
<Link href={post.url}>
|
||||||
@@ -49,9 +52,9 @@ export function PostListItem({ post }: Props) {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{post.description && (
|
{excerpt && (
|
||||||
<p className="line-clamp-2 text-sm text-slate-600 group-hover:text-slate-800 dark:text-slate-200 dark:group-hover:text-slate-100">
|
<p className="line-clamp-2 text-sm text-slate-600 group-hover:text-slate-800 dark:text-slate-200 dark:group-hover:text-slate-100">
|
||||||
{post.description}
|
{excerpt}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user