Merge pull request #45 from ybbarng/master

Fixes a crash when a post has no tag
This commit is contained in:
Alexander Shelepenok 2017-10-30 17:57:38 +02:00 committed by GitHub
commit 4ad32fb854
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -123,7 +123,7 @@ exports.onCreateNode = ({ node, boundActionCreators, getNode }) => {
value: slug
});
if (typeof node.frontmatter.tags !== 'undefined') {
if (node.frontmatter.tags) {
const tagSlugs = node.frontmatter.tags.map(
tag => `/tags/${_.kebabCase(tag)}/`
);

View File

@ -19,7 +19,7 @@ class PostTemplateDetails extends React.Component {
const tagsBlock = (
<div className="post-single__tags">
<ul className="post-single__tags-list">
{tags.map((tag, i) =>
{tags && tags.map((tag, i) =>
<li className="post-single__tags-list-item" key={tag}>
<Link to={tag} className="post-single__tags-list-item-link">
{post.frontmatter.tags[i]}