Skip to content

Commit

Permalink
fix: Minor bug fix for comments not displaying when there's only 1
Browse files Browse the repository at this point in the history
  • Loading branch information
zanechua committed Oct 1, 2020
1 parent 6d646f6 commit 2bceb40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ module.exports = {
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/comments`,
name: 'comments',
path: `${__dirname}/src/comments`
},
},
`gatsby-plugin-sharp`,
Expand Down
4 changes: 3 additions & 1 deletion src/templates/blog-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const Template = ({ data }) => {
const { posts, comments } = data // data.posts holds your post data
const { frontmatter, html } = posts;

console.log(comments);

let featuredImgFluid = frontmatter.featuredImage.childImageSharp.fluid
return (
<Layout className="blog-post-container">
Expand All @@ -38,7 +40,7 @@ const Template = ({ data }) => {
/>
</section>

{comments.edges.length > 1 && <CommentSection className="comment-section flex-1 pt-8" comments={comments} />}
{comments.edges.length >= 1 && <CommentSection className="comment-section flex-1 pt-8" comments={comments} />}
<CommentForm className="comment-form-section flex-1 pt-8" slug={frontmatter.slug}/>
</Layout>
)
Expand Down

0 comments on commit 2bceb40

Please sign in to comment.