diff --git a/constants/cms.ts b/constants/cms.ts index e500650..306a317 100644 --- a/constants/cms.ts +++ b/constants/cms.ts @@ -30,7 +30,8 @@ const CMS = { CTA_WHO_USES_OXEN: /^\{\{[\s]*who_uses_oxen[\s]*\}\}$/, CTA_SESSION_LOKINET: /^\{\{[\s]*session_lokinet[\s]*\}\}$/, }, - BLOG_RESULTS_PER_PAGE: 21, + BLOG_RESULTS_PER_PAGE_MAIN: 21, + BLOG_RESULTS_PER_PAGE_TAG: 20, }; export default CMS; diff --git a/pages/blog/index.tsx b/pages/blog/index.tsx index 2f4f2d8..97d76c7 100644 --- a/pages/blog/index.tsx +++ b/pages/blog/index.tsx @@ -26,7 +26,7 @@ export const getServerSideProps: GetServerSideProps = async context => { // Pagination only occurs when tag isnt defined. // If tag is defined, pagination is for tag results const { posts, total: totalPosts } = await cms.fetchBlogEntries( - tag ? 8 : CMS.BLOG_RESULTS_PER_PAGE, + tag ? 8 : CMS.BLOG_RESULTS_PER_PAGE_MAIN, tag ? 1 : page, ); console.log(posts); @@ -40,7 +40,7 @@ export const getServerSideProps: GetServerSideProps = async context => { total: _tagTotalPosts, } = await cms.fetchBlogEntriesByTag( tag ?? '', - CMS.BLOG_RESULTS_PER_PAGE, + CMS.BLOG_RESULTS_PER_PAGE_TAG, page, ); tagPosts = _tagPosts; @@ -49,7 +49,7 @@ export const getServerSideProps: GetServerSideProps = async context => { const total = tagTotalPosts ?? totalPosts; console.log(total); - const pageCount = Math.ceil(total / CMS.BLOG_RESULTS_PER_PAGE); + const pageCount = Math.ceil(total / CMS.BLOG_RESULTS_PER_PAGE_MAIN); return { props: { diff --git a/services/cms.tsx b/services/cms.tsx index ff0e714..0d9c2c7 100644 --- a/services/cms.tsx +++ b/services/cms.tsx @@ -32,7 +32,7 @@ export class CmsApi { } public async fetchBlogEntries( - quantity = CMS.BLOG_RESULTS_PER_PAGE, + quantity = CMS.BLOG_RESULTS_PER_PAGE_MAIN, page = 1, ): Promise { const entries = await this.client.getEntries({ @@ -75,7 +75,7 @@ export class CmsApi { public async fetchBlogEntriesByTag( tag: string, - quantity = CMS.BLOG_RESULTS_PER_PAGE, + quantity = CMS.BLOG_RESULTS_PER_PAGE_TAG, page = 1, ): Promise { const entries = await this.client.getEntries({