Tips for filtering out future date publishing posts in Gatsby and Sanity.io tutorial.

7 replies
Last updated: Dec 3, 2020
I am following this tutorial by
user Y
and can’t seem to filter out the future date publishing posts. Any quick tips how I can do that? I tried following the
index.js
template on
sanity-template-gatsby-blog
but couldn’t figure it out

https://css-tricks.com/how-to-make-taxonomy-pages-with-gatsby-and-sanity-io/
Dec 1, 2020, 4:58 PM
ah hm i see. I’ve been experimenting and testing out, on production unpublished post isn’t showing up but “future post” somehow did, but 404 when visited: https://5fc681e600899d000810880e--afif-dev.netlify.app/blog/
Dec 1, 2020, 5:54 PM
user Y
I’m not super verse in JS as a designer but i’ll try to retrofit your example into what I have here https://github.com/ajmalafif/afif.dev/blob/develop/web/src/pages/blog.js
Dec 1, 2020, 5:56 PM
just sharing my finding and discovery, i managed to make it work, not sure if its “correct” way to do things but now the post link appears correctly https://github.com/ajmalafif/afif.dev/blob/3e55e713c9ee20c0d91e23d2db710320a740fb23/web/src/templates/category.js#L34
Dec 2, 2020, 4:34 PM
This works, but you can also put the filter in the graphql query like we have done in the example I shared with you 🙂
Dec 3, 2020, 12:46 PM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?