Skip to content

Commit 61e3f3f

Browse files
committed
sheet views count null check
1 parent bfae45c commit 61e3f3f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/templates/blog-post.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ class BlogPostTemplate extends React.Component {
2121
render() {
2222
const post = this.props.data.mdx
2323
const siteTitle = this.props.data.site.siteMetadata.title
24-
const views = this.props.data.sheetViews.count
24+
const views = 0;
25+
if (this.props.data.sheetViews && this.props.data.sheetViews.count) {
26+
views = this.props.data.sheetViews.count
27+
}
2528
// const comments = this.props.data.allStackCheatsComments.edges
2629

2730
return (

0 commit comments

Comments
 (0)