fix(route): gq tw no header img (#11556)

This commit is contained in:
Tony 2023-01-04 02:31:00 -10:00 committed by GitHub
parent 0a943aa592
commit 0b9ccd763e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,6 @@
{{ if src }}
<figure>
<img src="{{ src }}"{{ if alt }} alt="{{@ alt }}"{{ /if }}>
{{ if alt }}<figcaption>{{@ alt }}</figcaption>{{ /if }}
</figure>
{{ /if }}

View File

@ -136,8 +136,8 @@ module.exports = async (ctx) => {
dangerousDek: transformed.article.headerProps.dangerousDek, // quote
lede: art(path.join(__dirname, '../templates/img.art'), {
// header image
src: largestImage(lede.sources, lede.id),
alt: lede.caption,
src: lede?.sources ? largestImage(lede.sources, lede.id) : null,
alt: lede?.caption,
}),
articleBody: articleBody.html(),
});