diff --git a/blogContent/photos/2019/dir.md b/blogContent/photos/2019/dir.md new file mode 100644 index 0000000..a33b6c6 --- /dev/null +++ b/blogContent/photos/2019/dir.md @@ -0,0 +1 @@ +# June diff --git a/blogContent/photos/2019/june/pixley-falls/DSC01102.jpg b/blogContent/photos/2019/june/1.jpg similarity index 100% rename from blogContent/photos/2019/june/pixley-falls/DSC01102.jpg rename to blogContent/photos/2019/june/1.jpg diff --git a/blogContent/photos/2019/june/dir.md b/blogContent/photos/2019/june/dir.md new file mode 100644 index 0000000..a33b6c6 --- /dev/null +++ b/blogContent/photos/2019/june/dir.md @@ -0,0 +1 @@ +# June diff --git a/blogContent/photos/2019/june/mohawk-river-trail/DSC02237.jpg b/blogContent/photos/2019/june/mohawk-river-trail/1.jpg similarity index 100% rename from blogContent/photos/2019/june/mohawk-river-trail/DSC02237.jpg rename to blogContent/photos/2019/june/mohawk-river-trail/1.jpg diff --git a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02107.jpg b/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02107.jpg deleted file mode 100644 index 9af75c8..0000000 Binary files a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02107.jpg and /dev/null 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 deleted file mode 100644 index ebcbc25..0000000 Binary files a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02145.jpg and /dev/null 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 deleted file mode 100644 index 96594f7..0000000 Binary files a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02154.jpg and /dev/null 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 deleted file mode 100644 index ac1ebb7..0000000 Binary files a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02168.jpg and /dev/null 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 deleted file mode 100644 index 8c3ba5f..0000000 Binary files a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02203.jpg and /dev/null 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 deleted file mode 100644 index ef172be..0000000 Binary files a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02207.jpg and /dev/null 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 deleted file mode 100644 index 93a1648..0000000 Binary files a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02221.jpg and /dev/null 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 deleted file mode 100644 index 1ad9389..0000000 Binary files a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02237.jpg and /dev/null 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 deleted file mode 100644 index 5b82f86..0000000 Binary files a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02282.jpg and /dev/null 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 deleted file mode 100644 index 435126d..0000000 Binary files a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02288.jpg and /dev/null 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 deleted file mode 100644 index c812c76..0000000 Binary files a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02296.jpg and /dev/null 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 deleted file mode 100644 index 2fa5d85..0000000 Binary files a/blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02317.jpg and /dev/null differ diff --git a/blogContent/photos/2019/june/pixley-falls/1.jpg b/blogContent/photos/2019/june/pixley-falls/1.jpg new file mode 100644 index 0000000..aed102f Binary files /dev/null and b/blogContent/photos/2019/june/pixley-falls/1.jpg differ diff --git a/routes/photos/index.js b/routes/photos/index.js index 0ec8cab..4b7f5d4 100644 --- a/routes/photos/index.js +++ b/routes/photos/index.js @@ -15,17 +15,22 @@ const fs = require('fs'); routes.get('/', (request, result) => { //do something later + result.write("Not implemented yet."); + result.end(); }); const photosBaseDir = "blogContent/photos"; + photoPageBuilder = function(filename, request, templateContext) { + const imagePath = "/" + photosBaseDir + filename + "/"; return new Promise((resolve, reject)=> { if(fs.existsSync(photosBaseDir + filename + "/post.md")) { + var markdownContent = utils.getFileContents( photosBaseDir + filename + "/post.md"); @@ -34,7 +39,6 @@ photoPageBuilder = function(filename, request, templateContext) { templateContext.images = []; templateContext.mainPost = html; - var imagePath = "/" + photosBaseDir + filename + "/"; fs.readdirSync(photosBaseDir + filename).forEach(file=> { if(file.includes('.jpg')) //doesn't pick up mark down files @@ -51,6 +55,21 @@ photoPageBuilder = function(filename, request, templateContext) }) } + else if(fs.existsSync(photosBaseDir + filename + "/dir.md")) + { + templateContext.folders = []; + templateContext.directory = true; + fs.readdirSync(photosBaseDir + filename).forEach(file=> + { + if(!file.includes('.md') && !file.includes('.jpg')) //only pick up folders + { + templateContext.folders.push({url: "/photos" + filename + "/" + file, + img:imagePath + file + "/1.jpg"}); + } + }); + + resolve(); + } else { templateContext.error = true; diff --git a/templates/photos/photosEntry.html b/templates/photos/photosEntry.html index 5e8eb1d..0884c83 100644 --- a/templates/photos/photosEntry.html +++ b/templates/photos/photosEntry.html @@ -11,36 +11,59 @@ {mainPost} -
- - {for img in images} -
-
-
- - - + {if directory} +
+ {for dir in folders} +
+
+
+ + + +
+
-
-
- {/for} - - {if error} -
-

Page Not Found

-
- Page not found + {/for} +
+ + {else} + +
+ + {for img in images} +
+
+
+ + + +
+
-
-

- {/if} - + {/for} + + + - - + + - + +
+ {/if} + + + {if error} +
+

Page Not Found

+
+ Page not found +
+

+ {/if} + +