diff --git a/utils/paginate.js b/utils/paginate.js
index 1b24af8..6871fb4 100644
--- a/utils/paginate.js
+++ b/utils/paginate.js
@@ -39,8 +39,12 @@ module.exports = (
totalPages: pageCount,
// The path to the previous paginated page (or an empty string)
prevPath: paginationPath(basePath, index - 1, pageCount),
+ // The path to the first paginated page (or an empty string)
+ firstPath: paginationPath(basePath, 0, pageCount),
// The path to the next paginated page (or an empty string)
nextPath: paginationPath(basePath, index + 1, pageCount),
+ // The path to the last paginated page (or an empty string)
+ lastPath: paginationPath(basePath, pageCount - 1, pageCount),
// Current page ID for displaying between chevrons
pageID: index + 1
}
diff --git a/utils/paginate.test.js b/utils/paginate.test.js
index 9bfa6ef..2b76056 100644
--- a/utils/paginate.test.js
+++ b/utils/paginate.test.js
@@ -15,8 +15,10 @@ test('stops generating a next page link on the final paginated page', () => {
);
assert.equal(createdPages.length, 16);
+ assert.equal(createdPages[0].context.firstPath, '/');
assert.equal(createdPages[0].context.nextPath, '/page/2');
assert.equal(createdPages[14].context.nextPath, '/page/16');
assert.equal(createdPages[15].context.pageID, 16);
+ assert.equal(createdPages[15].context.lastPath, '/page/16');
assert.equal(createdPages[15].context.nextPath, '');
});