1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-29 20:21:50 +02:00

Allow mutation of guide template for HTML unescaping (#8816)

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
This commit is contained in:
Emmanuel Ferdman
2025-06-23 13:07:56 +03:00
committed by GitHub
parent bd111db80f
commit d0c5e3ba68

View File

@@ -241,19 +241,19 @@ async function generateGuideOpenGraph() {
const image =
author?.imageUrl || 'https://roadmap.sh/images/default-avatar.png';
const isExternalImage = image?.startsWith('http');
let authorImageExtention = '';
let authorImageExtension = '';
let authorAvatar;
if (!isExternalImage) {
authorAvatar = await fs.readFile(path.join(ALL_AUTHOR_IMAGE_DIR, image));
authorImageExtention = image?.split('.')[1];
authorImageExtension = image?.split('.')[1];
}
const template = getGuideTemplate({
let template = getGuideTemplate({
...guide,
authorName: author.name,
authorAvatar: isExternalImage
? image
: `data:image/${authorImageExtention};base64,${authorAvatar.toString('base64')}`,
: `data:image/${authorImageExtension};base64,${authorAvatar.toString('base64')}`,
});
if (
hasSpecialCharacters(guide.title) ||