Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Remove previous/next component #8

Open
mittalyashu opened this issue May 6, 2019 · 0 comments
Open

Remove previous/next component #8

mittalyashu opened this issue May 6, 2019 · 0 comments

Comments

@mittalyashu
Copy link
Owner

Should we remove Previous/Next component

image

Gridsome doesn't support Previous and Next post from the current post. We are using this method getPreviousNext() to get the previous and next post.

getPreviousNext() {
      const allBlogs = this.$static.allPost.edges;
      for (let i = 0; i < allBlogs.length; i++) {
        if (allBlogs[i].node.id === this.currentPostId) {
          if (i > 0) {
            this.PreviousNexts.push(allBlogs[i - 1].node);
          }
          if (allBlogs.length > i) {
            this.PreviousNexts.push(allBlogs[i + 1].node);
          }
        }
      }
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant