From 78b236be5fa78150b7792533a2a952c8006885c1 Mon Sep 17 00:00:00 2001 From: Josh Cunningham Date: Sun, 9 Feb 2020 21:15:55 -0800 Subject: [PATCH] Layout and config file updates --- .eleventy.js | 14 ++- .gitignore | 4 + content/_css/.keep | 0 content/_includes/_html.njk | 142 ++++++++++++++++++++++++-- content/_includes/layouts/all.njk | 19 +++- content/_includes/layouts/gallery.njk | 2 +- content/_includes/layouts/link.njk | 2 +- content/_includes/layouts/page.njk | 2 +- content/_includes/layouts/post.njk | 2 +- content/_includes/layouts/quote.njk | 2 +- content/_includes/layouts/status.njk | 2 +- package-lock.json | 13 ++- package.json | 8 +- 13 files changed, 189 insertions(+), 23 deletions(-) create mode 100644 content/_css/.keep diff --git a/.eleventy.js b/.eleventy.js index 873c6c2..736c12a 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,16 +1,22 @@ +const moment = require('moment'); +moment.locale('en'); + module.exports = function(eleventyConfig) { - const postLayouts = [ 'post', 'link', 'quote', 'gallery', 'status' ]; + eleventyConfig.addLayoutAlias('page', 'layouts/page.njk'); + + const postLayouts = [ 'post', 'link', 'quote', 'gallery' ]; eleventyConfig.addLayoutAlias('gallery', 'layouts/gallery.njk'); eleventyConfig.addLayoutAlias('link', 'layouts/link.njk'); - eleventyConfig.addLayoutAlias('page', 'layouts/page.njk'); eleventyConfig.addLayoutAlias('post', 'layouts/post.njk'); eleventyConfig.addLayoutAlias('quote', 'layouts/quote.njk'); eleventyConfig.addLayoutAlias('status', 'layouts/status.njk'); eleventyConfig.setUseGitIgnore(false); + eleventyConfig.setTemplateFormats([ 'md', 'css' ]); + eleventyConfig.addCollection('postsCollection', function(collection) { const tmpCollection = collection.getAllSorted(); return tmpCollection.reverse().filter(function(tpl) { @@ -18,6 +24,10 @@ module.exports = function(eleventyConfig) { }); }); + eleventyConfig.addFilter('dateformat', function(dateIn) { + return moment(dateIn).format('MMM DD, YYYY [at] h:mm a'); + }); + return { dir: { input: "content", diff --git a/.gitignore b/.gitignore index 47ee631..8bc9f86 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ node_modules _dist content/**/*.md +npm-debug.log +content/_css/main.css +sass +svg diff --git a/content/_css/.keep b/content/_css/.keep new file mode 100644 index 0000000..e69de29 diff --git a/content/_includes/_html.njk b/content/_includes/_html.njk index 3ba0f1b..007601a 100644 --- a/content/_includes/_html.njk +++ b/content/_includes/_html.njk @@ -1,10 +1,138 @@ - - - - {{ title }} - Josh Can Help - - - {% block content %}{% endblock %} + + + + + + + + + + + + {{ title }} - Josh Can Help + + + + + + + + + + + + {%- if excerpt -%} + + {%- endif -%} + + + + + + +
+
+

+ +

+ + +
+ +
+ {% block content %}{% endblock %} +
+
+ +
    + {%- if layout in [ 'post', 'gallery', 'link', 'post', 'quote', 'status' ] -%} +
  • +

    Published:

    +

    {{ page.date | dateformat }}

    +
  • + +
  • +

    Tags:

    +

    + {%- for tag in tags -%} + {{ tag }}
    + {%- endfor -%} +

    +
  • + {%- endif -%} +
+
+
+ + diff --git a/content/_includes/layouts/all.njk b/content/_includes/layouts/all.njk index d4ec363..98e7715 100644 --- a/content/_includes/layouts/all.njk +++ b/content/_includes/layouts/all.njk @@ -2,15 +2,26 @@ {% block content %}
+

{{ title }}

{{ content | safe }} -