Browse Source

Updated blog to include directory views for photos.

pull/77/head
jrtechs 4 years ago
parent
commit
f1dcdca671
19 changed files with 70 additions and 26 deletions
  1. +1
    -0
      blogContent/photos/2019/dir.md
  2. +0
    -0
      blogContent/photos/2019/june/1.jpg
  3. +1
    -0
      blogContent/photos/2019/june/dir.md
  4. +0
    -0
      blogContent/photos/2019/june/mohawk-river-trail/1.jpg
  5. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02107.jpg
  6. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02145.jpg
  7. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02154.jpg
  8. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02168.jpg
  9. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02203.jpg
  10. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02207.jpg
  11. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02221.jpg
  12. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02237.jpg
  13. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02282.jpg
  14. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02288.jpg
  15. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02296.jpg
  16. BIN
      blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02317.jpg
  17. BIN
      blogContent/photos/2019/june/pixley-falls/1.jpg
  18. +20
    -1
      routes/photos/index.js
  19. +48
    -25
      templates/photos/photosEntry.html

+ 1
- 0
blogContent/photos/2019/dir.md View File

@ -0,0 +1 @@
# June

blogContent/photos/2019/june/pixley-falls/DSC01102.jpg → blogContent/photos/2019/june/1.jpg View File


+ 1
- 0
blogContent/photos/2019/june/dir.md View File

@ -0,0 +1 @@
# June

blogContent/photos/2019/june/mohawk-river-trail/DSC02237.jpg → blogContent/photos/2019/june/mohawk-river-trail/1.jpg View File


BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02107.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 71 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02145.jpg View File

Before After
Width: 200  |  Height: 129  |  Size: 72 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02154.jpg View File

Before After
Width: 200  |  Height: 108  |  Size: 68 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02168.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 72 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02203.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 64 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02207.jpg View File

Before After
Width: 200  |  Height: 172  |  Size: 69 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02221.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 64 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02237.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 66 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02282.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 67 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02288.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 76 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02296.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 66 KiB

BIN
blogContent/photos/2019/june/mohawk-river-trail/preview/DSC02317.jpg View File

Before After
Width: 200  |  Height: 134  |  Size: 68 KiB

BIN
blogContent/photos/2019/june/pixley-falls/1.jpg View File

Before After
Width: 1080  |  Height: 783  |  Size: 631 KiB

+ 20
- 1
routes/photos/index.js View File

@ -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;

+ 48
- 25
templates/photos/photosEntry.html View File

@ -11,36 +11,59 @@
{mainPost}
</div>
<div id="lightgallery" class="row p-2 align-content-center">
{for img in images}
<div class="col-lg-4 col-md-6 col-xs-12 thumb p-12 text-center" data-src='{img.full}'>
<div class="span4"></div>
<div class="span4">
<a href="{img.full}">
<img class="img-thumbnail img-responsive center-block" width="100%" src="{img.full}" />
</a>
{if directory}
<div class="row p-2 align-content-center">
{for dir in folders}
<div class="col-lg-4 col-md-6 col-xs-12 thumb p-12 text-center"'>
<div class="span4"></div>
<div class="span4">
<a href="{dir.url}">
<img class="img-thumbnail img-responsive center-block" width="100%" src="{dir.img}" />
</a>
</div>
<div class="span4"></div>
</div>
<div class="span4"></div>
</div>
{/for}
{if error}
<div class="row p-lg-0">
<h1 class="align-content-center">Page Not Found</h1>
<div class="align-content-center center-block">
<img src="/includes/img/404.jpg" alt="Page not found" width="70%" />
{/for}
</div>
{else}
<div id="lightgallery" class="row p-2 align-content-center">
{for img in images}
<div class="col-lg-4 col-md-6 col-xs-12 thumb p-12 text-center" data-src='{img.full}'>
<div class="span4"></div>
<div class="span4">
<a href="{img.full}">
<img class="img-thumbnail img-responsive center-block" width="100%" src="{img.full}" />
</a>
</div>
<div class="span4"></div>
</div>
</div>
<br><br>
{/if}
<!--<a href="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg">-->
{/for}
<!--<a href="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg">-->
<!--<img src="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg" />-->
<!--</a>-->
<!--<a href="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg">-->
<!--</a>-->
<!--<a href="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg">-->
<!--<img src="/blogContent/photos/2019/june/mohawk-river-trail/DSC02145.jpg" />-->
<!--</a>-->
<!--</a>-->
</div>
{/if}
{if error}
<div class="row p-lg-0">
<h1 class="align-content-center">Page Not Found</h1>
<div class="align-content-center center-block">
<img src="/includes/img/404.jpg" alt="Page not found" width="70%" />
</div>
</div>
<br><br>
{/if}
</div>
<!--

Loading…
Cancel
Save