2021-03-05 08:32:06 -08:00
|
|
|
<template>
|
|
|
|
<NotFound v-if="!content"/>
|
|
|
|
<div v-else class="blog-post">
|
|
|
|
<router-link :to="'/' + config.links.blogRoute" v-if="Object.keys(config.contact.blog).length">
|
|
|
|
<Icon v="pen-nib"/>
|
|
|
|
<T>contact.team.blog</T>
|
|
|
|
</router-link>
|
|
|
|
|
|
|
|
<div v-html="content"></div>
|
2021-04-14 10:17:57 -07:00
|
|
|
|
|
|
|
<Separator icon="heart"/>
|
|
|
|
|
|
|
|
<Support/>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<Share :title="title"/>
|
|
|
|
</section>
|
2021-03-05 08:32:06 -08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { head } from "../src/helpers";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
async asyncData({route}) {
|
|
|
|
try {
|
2021-03-21 14:58:25 -07:00
|
|
|
const content = (await import(`../data/blog/${route.params.slug}.md`)).default
|
|
|
|
.replace(/<table>/g, '<div class="table-responsive"><table class="table table-striped small">')
|
|
|
|
.replace(/<\/table>/g, '</table></div>')
|
2021-03-25 07:03:26 -07:00
|
|
|
.replace(/<a href="http/g, '<a target="_blank" rel="noopener" href="http')
|
2021-03-21 14:58:25 -07:00
|
|
|
;
|
2021-03-05 08:32:06 -08:00
|
|
|
const titleMatch = content.match('<h1[^>]*>([^<]+)</h1>');
|
|
|
|
const title = titleMatch ? titleMatch[1] : null;
|
|
|
|
const imgMatch = content.match('<img src="([^"]+)"[^>]*>');
|
|
|
|
const img = imgMatch ? imgMatch[1] : null;
|
|
|
|
|
|
|
|
return {
|
|
|
|
content,
|
|
|
|
title,
|
|
|
|
img,
|
|
|
|
}
|
|
|
|
} catch {
|
|
|
|
return {
|
|
|
|
content: null,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
},
|
|
|
|
head() {
|
|
|
|
return head({
|
|
|
|
title: this.title,
|
|
|
|
banner: this.img,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import "assets/variables";
|
|
|
|
|
|
|
|
.blog-post {
|
|
|
|
img {
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
figure {
|
|
|
|
width: 100%;
|
|
|
|
max-width: 24rem;
|
|
|
|
padding: $spacer;
|
|
|
|
img {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
figcaption {
|
|
|
|
margin-top: $spacer / 2;
|
|
|
|
font-size: $small-font-size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.forms-grid {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fit, minmax(18rem, 3fr));
|
|
|
|
grid-gap: $spacer;
|
|
|
|
justify-items: center;
|
|
|
|
figure {
|
|
|
|
padding: 0;
|
|
|
|
figcaption {
|
|
|
|
font-size: 90%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|