mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-27 06:52:35 -04:00
[blog] finding hero image in ANY paragraph
This commit is contained in:
parent
97195eddc3
commit
e2109bf940
@ -41,7 +41,10 @@ router.get('/blog', handleErrorAsync(async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
hero = content[2].match(/^!\[[^\]]*]\(([^)]+)\)$/)[1];
|
const images = content.map(x => x.match(/^!\[[^\]]*]\(([^)]+)\)$/)).filter(x => !!x);
|
||||||
|
if (images.length) {
|
||||||
|
hero = images[0][1];
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user