diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02107.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02107.jpg new file mode 100644 index 0000000..9af75c8 Binary files /dev/null and b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02107.jpg differ diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02145.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02145.jpg new file mode 100644 index 0000000..ebcbc25 Binary files /dev/null and b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02145.jpg differ diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02154.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02154.jpg new file mode 100644 index 0000000..96594f7 Binary files /dev/null and b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02154.jpg differ diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02168.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02168.jpg new file mode 100644 index 0000000..ac1ebb7 Binary files /dev/null and b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02168.jpg differ diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02203.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02203.jpg new file mode 100644 index 0000000..8c3ba5f Binary files /dev/null and b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02203.jpg differ diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02207.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02207.jpg new file mode 100644 index 0000000..ef172be Binary files /dev/null and b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02207.jpg differ diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02221.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02221.jpg new file mode 100644 index 0000000..93a1648 Binary files /dev/null and b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02221.jpg differ diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02237.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02237.jpg new file mode 100644 index 0000000..1ad9389 Binary files /dev/null and b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02237.jpg differ diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02282.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02282.jpg new file mode 100644 index 0000000..5b82f86 Binary files /dev/null and b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02282.jpg differ diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02288.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02288.jpg new file mode 100644 index 0000000..435126d Binary files /dev/null and b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02288.jpg differ diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02296.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02296.jpg new file mode 100644 index 0000000..c812c76 Binary files /dev/null and b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02296.jpg differ diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02317.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02317.jpg new file mode 100644 index 0000000..2fa5d85 Binary files /dev/null and b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02317.jpg differ diff --git a/routes/photos/index.js b/routes/photos/index.js index 7000a8e..206a72b 100644 --- a/routes/photos/index.js +++ b/routes/photos/index.js @@ -8,16 +8,41 @@ const whiskers = require('whiskers'); const url = require('url'); +const fs = require('fs'); + routes.get('/', (request, result) => { //do something later - console.log("boo"); }); + + +const photosBaseDir = "blogContent/photos"; +photoPageBuilder = function(filename, request, templateContext) +{ + if(fs.existsSync(photosBaseDir + filename)) + { + templateContext.images = []; + var imagePath = "/" + photosBaseDir + filename + "/"; + fs.readdirSync(photosBaseDir + filename).forEach(file=> + { + if(file.includes('.jpg')) //doesn't pick up mark down files + { + templateContext.images.push({full:imagePath+ file, + preview:imagePath + "preview/" + file}); + } + }); + } + else + { + templateContext.error = true; + } +}; + routes.get('*', (request, result) => { pageBuilder.buildPageWithTemplate(request, result, - function(){}, "photos/photosEntry.html"); + photoPageBuilder, "photos/photosEntry.html"); }); module.exports = routes; \ No newline at end of file diff --git a/templates/photos/photosEntry.html b/templates/photos/photosEntry.html index e436f47..bb15336 100644 --- a/templates/photos/photosEntry.html +++ b/templates/photos/photosEntry.html @@ -5,14 +5,32 @@
- -
- - - - - - +



+
+ + {for img in images} +
+ + + +
+ {/for} + + {if error} +
+

Page Not Found

+
+ Page not found +
+
+

+ {/if} + + + + + +
diff --git a/utils/pageBuilder.js b/utils/pageBuilder.js index 0457396..d4900a6 100644 --- a/utils/pageBuilder.js +++ b/utils/pageBuilder.js @@ -188,6 +188,7 @@ module.exports = var templateContext = Object(); Promise.all([includes.include("templates/" + templateFile), includes.printHeader(templateContext), + templateFiller(request.url, request, templateContext), includes.printFooter(templateContext), require("../blog/sidebar.js").main(templateContext)]) .then(function (content)