#99 host blog entries - images

This commit is contained in:
Andrea Vos 2020-11-13 23:09:18 +01:00
parent 94dd1efbd5
commit 21aeb610a4
2 changed files with 4 additions and 1 deletions

View File

@ -13,10 +13,12 @@
try {
const content = (await import(`../locale/pl/blog/${route.params.slug}.md`)).default;
const title = content.match('<h1[^>]*>([^<]+)</h1>')[1];
const img = content.match('<img src="([^"]+)"[^>]*>')[1];
return {
content,
title,
img,
}
} catch {
return {};
@ -25,6 +27,7 @@
head() {
return head({
title: this.title,
banner: this.img,
});
},
};

View File

@ -34,7 +34,7 @@ export const head = ({title, description, banner}) => {
}
if (banner) {
banner = process.env.BASE_URL + '/' + banner;
banner = process.env.BASE_URL + '/' + banner.replace(/^\//, '');
meta.meta.push({ hid: 'og:logo', property: 'og:logo', content: banner });
meta.meta.push({ hid: 'twitter:image', property: 'twitter:image', content: banner });
}