Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
const {
default: { attributes, html }
} = await import(`../../content/${query.year}/${paddedDate}.md`);
const authorInfo = await getAuthors(attributes.author);
const post = {
html,
...attributes,
author: authorInfo
};
return {
post,
year: Number(query.year),
date: Number(query.date),
readingTime: calculateReadingTime(post.html).text
};
} catch (e) {
console.error('such error', e);
return {
year: Number(query.year),
date: Number(query.date),
notFound: true
};
}
};
export default withRouter(PostPage);
render() {
const { intl, form, loading, isUpdating, saving, draftId } = this.props;
const { getFieldDecorator } = form;
const {
body,
bodyHTML,
linkedObjects,
influenceRemain,
isLinkedObjectsValid,
canCreateNewObject,
} = this.state;
const { words, minutes } = readingTime(bodyHTML);
const linkedObjectsTitle = (
<div>
}
>
<label>
</label>
</div>
function BlogPostPage(props) {
const {content: BlogPostContents} = props;
const {frontMatter, metadata} = BlogPostContents;
const {author_github, id, title} = frontMatter;
const {date: dateString, tags} = metadata;
const readingStats = readingTime(BlogPostContents.toString());
const date = new Date(Date.parse(dateString));
const domainTag = enrichTags(tags, 'blog').find(tag => tag.category == 'domain');
const domain = domainTag ? domainTag.value : null;
const newPost = fetchNewPost();
if (newPost && newPost.id == id) {
viewedNewPost();
}
return (
<article>
<header>
<div>
<div class="hero--avatar">
</div></div></header></article>
render() {
const { intl, form, loading, isUpdating, saving, draftId } = this.props;
const { getFieldDecorator } = form;
const { body, bodyHTML } = this.state;
const { words, minutes } = readingTime(bodyHTML);
return (
<form>
<title>
{intl.formatMessage({ id: 'write_post', defaultMessage: 'Write post' })} - Busy
</title>
}
>
{getFieldDecorator('title', {</form>
function BlogPostItem(props) {
const {
children,
frontMatter,
metadata,
truncated,
isBlogPostPage = false,
} = props;
const {date: dateString, description, permalink, tags} = metadata;
const {author_github, title} = frontMatter;
const readingStats = readingTime(children.toString());
const date = new Date(Date.parse(dateString));
const domainTag = enrichTags(tags, 'blog').find(tag => tag.category == 'domain');
const domain = domainTag ? domainTag.value : null;
return (
<article>
<h2>{title}</h2>
<div>{description}</div>
<time datetime="{date.toISOString()}" pubdate="pubdate">{dateFormat(date, "mmm dS")}</time> / {readingStats.text}} rel="author" />
</article>
);
}
<span>
</span>
{Math.ceil(readingTime(post.body).minutes) > 1 && (
<span>
<span>
</span>
}
>
<span>
</span>
</span>
)}