Skip to content

Commit

Permalink
Merge pull request #226 from Web-Dev-Path/fix/empty-blog-category
Browse files Browse the repository at this point in the history
Fix Empty blog category
  • Loading branch information
mariana-caldas authored Nov 30, 2024
2 parents 7260e16 + ebc3ae7 commit 3608179
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed styling issue on nav links
- Fixed contact form message position
- Fixed blog images not loading due to dev.to changing image host (sub)domain
- Fixed empty blog category by using per_page parameter
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ This is how to get started locally:

<br />

## Developer Note

- The Dev.to API has a 30 posts limit by default and we updated it to 1000. If we need to fetch more posts, we will need to update the getStaticProps on `/pages/blog`. For more details, refer to the [API documentation](https://developers.forem.com/api/v1#tag/articles/operation/getArticles).

<br />

## License

This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
Expand Down
3 changes: 2 additions & 1 deletion pages/blog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export default function Blog({ posts }) {
}

export async function getStaticProps() {
const res = await fetch('https://dev.to/api/articles?username=wdp');
const PER_PAGE = 1000
const res = await fetch(`https://dev.to/api/articles?username=wdp&per_page=${PER_PAGE}`);
const posts = await res.json();

return {
Expand Down

0 comments on commit 3608179

Please sign in to comment.