feat: display cover on article page
This commit is contained in:
parent
666349c5b8
commit
fdd9f670e6
1 changed files with 9 additions and 3 deletions
|
@ -3,7 +3,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
|
||||
import { getCollection, getEntry } from 'astro:content';
|
||||
import Comments from "../../components/Comments.astro";
|
||||
import {getImage} from "astro:assets";
|
||||
import {getImage, Image} from "astro:assets";
|
||||
import {siteConfig} from "../../config";
|
||||
import ReplyViaEmail from "../../components/ReplyViaEmail.astro";
|
||||
import { ExtractFirstImage } from '../../plugins/extract-images';
|
||||
|
@ -60,6 +60,7 @@ const cover = customFeaturedImage || matchedImage_src?.src || firstImageURL || `
|
|||
<span class="date">(Updated on {new Date(lastUpdated).toISOString().split('T')[0]})</span>
|
||||
<span>|</span>
|
||||
<span class="wordcount">{wordcount.words} words</span>
|
||||
{ (cover && cover !== firstImageURL && cover !== `/blog/${slug}/featured.png`) && <Image class="cover" width=720 height=480 src={cover} alt={`cover of ${entry.data.title}`} /> }
|
||||
{headings.length !== 0 && <TableOfContents headings={headings} />}
|
||||
{entry.data.summary && <p class="summary">{entry.data.summary}</p> }
|
||||
<div class="content">
|
||||
|
@ -84,4 +85,9 @@ const cover = customFeaturedImage || matchedImage_src?.src || firstImageURL || `
|
|||
color: var(--secondary-text-color);
|
||||
margin: 1rem;
|
||||
}
|
||||
img.cover {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
margin: 1rem auto;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue