Closed lavaldi closed 4 years ago
Go to lavaldi.com/blog and try to search for "about" in the input.
No posts are showing, but the number of posts to the right says 1.
1
In addition to blog posts there are three markdown files in content/pages:
content/pages
content/pages/resume.md
content/pages/me.md
They are queried along with blog posts in this query:
https://github.com/lavaldi/lavaldi.github.com/blob/gatsby/src/pages/blog.js#L106-L131
They will never show up in the list of posts because posts that don't have the post template specified in frontmatter are filtered out client-side in the PostListing component:
post
PostListing
https://github.com/lavaldi/lavaldi.github.com/blob/gatsby/src/components/PostListing.js#L11
But they are still counted in the number of filtered posts:
https://github.com/lavaldi/lavaldi.github.com/blob/gatsby/src/pages/blog.js#L59
Filter these out server-side with GraphQL. Then the client-side filtering in PostListing can even be removed.
Go to lavaldi.com/blog and try to search for "about" in the input.
No posts are showing, but the number of posts to the right says
1
.Why?
In addition to blog posts there are three markdown files in
content/pages
:content/pages/resume.md
content/pages/me.md
They are queried along with blog posts in this query:
https://github.com/lavaldi/lavaldi.github.com/blob/gatsby/src/pages/blog.js#L106-L131
They will never show up in the list of posts because posts that don't have the
post
template specified in frontmatter are filtered out client-side in thePostListing
component:https://github.com/lavaldi/lavaldi.github.com/blob/gatsby/src/components/PostListing.js#L11
But they are still counted in the number of filtered posts:
https://github.com/lavaldi/lavaldi.github.com/blob/gatsby/src/pages/blog.js#L59
Solution
Filter these out server-side with GraphQL. Then the client-side filtering in
PostListing
can even be removed.