[blog] finding hero image in ANY paragraph

This commit is contained in:
Avris 2021-07-12 15:11:42 +02:00
parent 22b9837f2c
commit bc33d5953a
1 changed files with 4 additions and 1 deletions

View File

@ -41,7 +41,10 @@ router.get('/blog', handleErrorAsync(async (req, res) => {
}
try {
hero = content[2].match(/^!\[[^\]]*]\(([^)]+)\)$/)[1];
const images = content.map(x => x.match(/^!\[[^\]]*]\(([^)]+)\)$/)).filter(x => !!x);
if (images.length) {
hero = images[0][1];
}
} catch {
}