diff --git a/includes/includes.js b/includes/includes.js index 28e120f..68eb7fc 100644 --- a/includes/includes.js +++ b/includes/includes.js @@ -142,6 +142,7 @@ module.exports = }, + fetchTemplate: function(templateName) { return utils.include("templates/" + templateName); diff --git a/sites/blog.js b/sites/blog.js index 162f26a..da78c81 100644 --- a/sites/blog.js +++ b/sites/blog.js @@ -9,6 +9,10 @@ const whiskers = require('whiskers'); const TEMPLATE_FILE="blog/blogMain.html"; +const PAGINATION_TEMPLATE_KEY = "paginationTemplate"; +const PAGINATION_TEMPLATE_FILE = "blog/paginationBar.html"; + + //caching program to make the application run faster const cache = require('memory-cache'); @@ -74,8 +78,10 @@ module.exports= // cache is not tricked into storing same blog post a ton of times } } + var templateContext = Object(); Promise.all([includes.fetchTemplate(TEMPLATE_FILE), + utils.includeInObject(PAGINATION_TEMPLATE_KEY, templateContext, "templates/" + PAGINATION_TEMPLATE_FILE), includes.printHeader(templateContext), includes.printFooter(templateContext), require(file).main(filename, request, templateContext), diff --git a/templates/blog/blogMain.html b/templates/blog/blogMain.html index 6c4739e..319490f 100644 --- a/templates/blog/blogMain.html +++ b/templates/blog/blogMain.html @@ -32,23 +32,27 @@

{/for}
-
- {if newPostsURL} - - {/if} -
-
- {if oldPostsURL} - - - - {/if} -
+ + {>paginationTemplate} + + + + + + + + + + + + + + + + + +

diff --git a/templates/blog/paginationBar.html b/templates/blog/paginationBar.html new file mode 100644 index 0000000..1dd9896 --- /dev/null +++ b/templates/blog/paginationBar.html @@ -0,0 +1,45 @@ + \ No newline at end of file