Skip to content

Commit 30a6a24

Browse files
committed
Update comment'
1 parent 5a40331 commit 30a6a24

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

pages/blog/page/[pageNo].js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import axios from 'axios';
77
/**
88
* Internal Dependencies.
99
*/
10-
import { getPageOffset, PER_PAGE_FIRST, PER_PAGE_REST } from '../../../src/utils/pagination';
1110
import { handleRedirectsAndReturnData } from '../../../src/utils/slug';
1211
import { getPosts } from '../../../src/utils/blog';
1312
import { HEADER_FOOTER_ENDPOINT } from '../../../src/utils/constants/endpoints';

src/utils/pagination.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,3 @@
1-
export const PER_PAGE_FIRST = 9; // No of posts to be shown on first page.
2-
export const PER_PAGE_REST = 12; // No of posts to be shown following page and after.
3-
4-
export const getPageOffset = ( pageNo ) => {
5-
6-
/**
7-
* Offset is how many posts are already shown ( meaning, after how many posts should we start qurying ).
8-
* @type {number}
9-
*/
10-
let offset = 0;
11-
pageNo = Number( pageNo );
12-
if ( 1 === pageNo ) {
13-
offset = 0;
14-
} else if ( 2 === pageNo ) {
15-
offset = PER_PAGE_FIRST;
16-
} else {
17-
offset = PER_PAGE_FIRST + ( ( pageNo - 2 ) * PER_PAGE_REST );
18-
}
19-
return offset;
20-
};
21-
22-
export const totalPagesCount = ( totalPostsCount ) => {
23-
return Math.ceil( ( totalPostsCount - PER_PAGE_FIRST ) / PER_PAGE_REST + 1 );
24-
};
25-
261
/**
272
* Create Pagination Links Array.
283
*

0 commit comments

Comments
 (0)