[blog] finding hero image in ANY paragraph

This commit is contained in:
Andrea Vos 2021-07-12 17:11:42 +02:00
parent 97195eddc3
commit e2109bf940

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 {
}