diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0461f14a..82a16f50 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@ Change log
For detailed information check [Blogophon's releases on Github](https://github.com/fboes/blogophon/releases).
+* [x] New template variables for first and last page on index pages
* [x] Switched to `8fold-marked`
* [x] Removed AMP pages from sitemap as of https://twitter.com/JohnMu/status/786588362706673664
* [x] Adding INI syntax highlighting
diff --git a/htdocs/themes/default/templates/tags.html b/htdocs/themes/default/templates/tags.html
index e0b5a2af..ef694c0f 100644
--- a/htdocs/themes/default/templates/tags.html
+++ b/htdocs/themes/default/templates/tags.html
@@ -21,7 +21,7 @@
{{#i18n}}All tags{{/i18n}}
diff --git a/src/blogophon-index.js b/src/blogophon-index.js
index 19ad79a2..9bfb00da 100644
--- a/src/blogophon-index.js
+++ b/src/blogophon-index.js
@@ -232,12 +232,14 @@ var blogophonIndex = function() {
curPage = Math.round(curPage);
maxPage = Math.round(maxPage);
return {
+ firstUrl: (maxPage > 1) ? external.getPageName(0, maxPage, reverse, path) : null,
+ prevUrl: external.getPageName(curPage-1, maxPage, reverse, path),
currentUrl: external.getPageName(curPage, maxPage, reverse, path),
nextUrl: external.getPageName(curPage+1, maxPage, reverse, path),
- prevUrl: external.getPageName(curPage-1, maxPage, reverse, path),
+ lastUrl: external.getPageName(maxPage - 1, maxPage, reverse, path),
currentPage: (curPage+1),
- nextPage: ((curPage+2 < maxPage) ? curPage+2 : null),
prevPage: ((curPage > 0) ? curPage : null),
+ nextPage: ((curPage+2 < maxPage) ? curPage+2 : null),
maxPages: maxPage
};
};
diff --git a/src/generator.js b/src/generator.js
index 71c9fc3a..f9ec41da 100644
--- a/src/generator.js
+++ b/src/generator.js
@@ -359,8 +359,10 @@ var Generator = function(config) {
absoluteUrl: curUrlObj.absoluteUrl(),
absoluteUrlDirname: curUrlObj.absoluteUrlDirname()
};
+ curPageObj.firstUrl = indexUrl(curPageObj.firstUrl).relativeUrl();
curPageObj.prevUrl = indexUrl(curPageObj.prevUrl).relativeUrl();
curPageObj.nextUrl = indexUrl(curPageObj.nextUrl).relativeUrl();
+ curPageObj.lastUrl = indexUrl(curPageObj.lastUrl).relativeUrl();
if (config.specialFeatures.acceleratedmobilepages) {
curPageObj.meta.AbsoluteUrlAmp = curUrlObj.absoluteUrl('amp');
}
@@ -368,8 +370,10 @@ var Generator = function(config) {
if (config.specialFeatures.acceleratedmobilepages) {
curPageObj.ampCss = Mustache.ampCss;
+ curPageObj.firstUrl = indexUrl(curPageObj.firstUrl).relativeUrl('amp');
curPageObj.prevUrl = indexUrl(curPageObj.prevUrl).relativeUrl('amp');
curPageObj.nextUrl = indexUrl(curPageObj.nextUrl).relativeUrl('amp');
+ curPageObj.lastUrl = indexUrl(curPageObj.lastUrl).relativeUrl('amp');
curPageObj.consolidatedProperties = ampify.getConsolidatedProperties(curPageObj.index);
promises.push(fs.writeFileAsync(
diff --git a/test/blogophon-index.js b/test/blogophon-index.js
index eb4818fa..ed831d0d 100644
--- a/test/blogophon-index.js
+++ b/test/blogophon-index.js
@@ -1,14 +1,11 @@
'use strict';
exports.testGeneralFunctionality = function(test) {
- //test.expect(2);
+ test.expect(1);
var index = require('../src/blogophon-index');
test.ok(index(), 'Index does compile');
- //test.throws(function() {translations('xx');}, Error);
- //test.throws(function() {translations('de').getString('xx');}, Error);
-
test.done();
};