DEV Community

Discussion on: Gridsome Pagination

Collapse
 
eclecticcoding profile image
Chuck

So, I added the published feature to my blog site. You will need to add the following to the gridsome.server.js file. It will add the filter, but will ignore the published field in your development server:

module.exports = function(api) {
  api.loadSource(store => {
    if (process.env.NODE_ENV === 'production') {
      const posts = store.getContentType('Post')

      posts.data().forEach(node => {
        if (node.published !== true) {
          posts.removeNode(node.id)
        }
      })
    }
  })
}
Collapse
 
hizbe profile image
Muhammad Hizbullah

oke solved, thank's.

Thread Thread
 
eclecticcoding profile image
Chuck

Great I am glad this helped.