decaporg / decaporg/gatsby-starter-decap-cms

BlogRoll not using "count" property

Open
#844 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2k
Forks
951
PR merge metrics
No merged PRs in 30d

Description

## Feature request

**What is the expected behavior?**
The BlogRoll has a count property that doesn't look to be implemented.

**What is motivation or use case for adding/changing the behavior?**
We should be able to use this count property to determine the number of blog posts to return. For example, I have a "latest from the blog" section that only shows the latest 3 blog posts.

**How should this be implemented in your opinion?**
The BlogRoll component should receive props and pass that to the BlogRollTemplate. That count can be used to slice the initial data or as part of the .map() function.

I'm doing the latter with a ternary operator to keep the count property optional.
`{posts && posts.slice(0, (this.props.count != undefined ? this.props.count : this.props.data.length)).map(({ node: post }) => { ... }`

**Are you willing to work on this yourself?**
yes

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.