diff --git a/blog/renderNextBar.js b/blog/renderNextBar.js
index 3f73b2c..4453ae4 100644
--- a/blog/renderNextBar.js
+++ b/blog/renderNextBar.js
@@ -35,18 +35,36 @@ module.exports=
reject("Invalid Page");
}
+ var paginationObject = new Object();
+
var nextPage = currentPage + 1;
var previousPage = currentPage - 1;
if (isValidPage(previousPage, postsPerPage, totalPosts))
{
- templateContext.newPostsURL = baseURL + "?page=" + previousPage;
+ paginationObject.previous = {url: baseURL + "?page=" + previousPage};
}
if (isValidPage(nextPage, postsPerPage, totalPosts))
{
- templateContext.oldPostsURL = baseURL + "?page=" + nextPage
+ paginationObject.next = {url: baseURL + "?page=" + nextPage};
}
+ var page = 1;
+ var pages = [];
+ while(isValidPage(page, postsPerPage, totalPosts))
+ {
+ if(page === currentPage)
+ {
+ pages.push({isCurrent: true, number: page})
+ }
+ else
+ {
+ pages.push({number: page, url: baseURL + "?page=" + page})
+ }
+ page = page + 1;
+ }
+ paginationObject.pages = pages;
+ templateContext.pagination = paginationObject;
}
};
\ No newline at end of file
diff --git a/sites/blog.js b/sites/blog.js
index da78c81..1c1b142 100644
--- a/sites/blog.js
+++ b/sites/blog.js
@@ -88,7 +88,7 @@ module.exports=
require("../blog/sidebar.js").main(templateContext)])
.then(function (content)
{
- var html = whiskers.render(content[0], templateContext);
+ const html = whiskers.render(content[0], templateContext);
result.write(html);
result.end();
cache.put(filename + "?page=" + page, html);
diff --git a/templates/blog/blogMain.html b/templates/blog/blogMain.html
index 319490f..4bfc24b 100644
--- a/templates/blog/blogMain.html
+++ b/templates/blog/blogMain.html
@@ -31,29 +31,9 @@
{/for}
-