Skip to content

Commit

Permalink
Layout and config file updates
Browse files Browse the repository at this point in the history
  • Loading branch information
joshcanhelp committed Feb 10, 2020
1 parent 6c4a0b1 commit 78b236b
Show file tree
Hide file tree
Showing 13 changed files with 189 additions and 23 deletions.
14 changes: 12 additions & 2 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
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) {
if ( tpl.data.permalink && postLayouts.includes(tpl.data.layout) ) return tpl;
});
});

eleventyConfig.addFilter('dateformat', function(dateIn) {
return moment(dateIn).format('MMM DD, YYYY [at] h:mm a');
});

return {
dir: {
input: "content",
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
node_modules
_dist
content/**/*.md
npm-debug.log
content/_css/main.css
sass
svg
Empty file added content/_css/.keep
Empty file.
142 changes: 135 additions & 7 deletions content/_includes/_html.njk
Original file line number Diff line number Diff line change
@@ -1,10 +1,138 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>{{ title }} - Josh Can Help</title>
</head>
<body>
{% block content %}{% endblock %}
<html lang="en-US" class="no-js">
<head>

<script>
document.documentElement.className = document.documentElement.className.replace("no-js", "js");
</script>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="google-site-verification" content="LUHQNXTGWRW08M2FzdsoXt65KunT0hwMaXHCvNZnOO8">

<link rel="profile" href="https://gmpg.org/xfn/11">

<title>{{ title }} - Josh Can Help</title>

<meta property="og:title" content="{{ title }}">
<meta property="og:locale" content="en_US">
<meta property="og:site_name" content="Josh Can Help">
<meta property="og:type" content="website">

<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="{{ title }}">
<meta name="twitter:domain" content="Josh Can Help">
<meta name="twitter:site" content="@joshcanhelp">

{%- if excerpt -%}
<meta name="description" content="{{ post.data.excerpt }}">
{%- endif -%}

<link rel='stylesheet' id='allonsy-main-css' href='/_css/main.css?1=1' type='text/css' media='all'>

</head>
<body id="top">

<section class="jch-row">
<header class="jch-col jch-col__left jch-head">
<p>
<a href="/" class="jch-head--logo">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 864 370.919">
<path d="M428.667,369.818c-101.959,0-184.91-82.95-184.91-184.91C243.757,82.949,326.708,0,428.667,0
c101.959,0,184.909,82.949,184.909,184.908C613.576,286.868,530.626,369.818,428.667,369.818z M428.667,8
c-97.548,0-176.91,79.36-176.91,176.908c0,97.549,79.361,176.91,176.91,176.91c97.548,0,176.909-79.361,176.909-176.91
C605.576,87.36,526.215,8,428.667,8z M233.178,95.182H0v3.95h233.178V95.182z M233.178,276.16H0v3.95h233.178V276.16z M1.823,240.28
v-10.833c2.757,0,4.908-0.169,6.452-0.507c1.545-0.339,2.815-1.062,3.812-2.172c0.997-1.109,1.661-2.558,1.993-4.344
c0.332-1.786,0.499-4.26,0.499-7.419v-75.827h12.755v75.827c0,4.589-0.267,8.378-0.797,11.369c-0.532,2.99-1.503,5.577-2.915,7.758
c-1.412,2.182-3.372,3.752-5.879,4.711c-2.508,0.959-5.688,1.438-9.542,1.438H1.823z M63.108,241.295
c-4.484,0-8.33-0.771-11.535-2.313c-3.206-1.542-5.755-3.798-7.648-6.771c-1.894-2.971-3.272-6.46-4.136-10.466
c-0.864-4.006-1.295-8.66-1.295-13.963V171.11c0-5.303,0.431-9.93,1.295-13.879c0.863-3.949,2.242-7.381,4.136-10.296
c1.893-2.914,4.442-5.106,7.648-6.573c3.205-1.467,7.05-2.2,11.535-2.2c8.702,0,14.98,2.821,18.834,8.462
c3.853,5.642,5.78,13.805,5.78,24.486v36.673c0,5.228-0.441,9.845-1.32,13.851c-0.881,4.006-2.267,7.504-4.161,10.494
s-4.443,5.266-7.648,6.827C71.387,240.514,67.559,241.295,63.108,241.295z M53.815,224.877c1.71,3.047,4.808,4.57,9.292,4.57
s7.581-1.523,9.292-4.57c1.71-3.046,2.566-7.541,2.566-13.484v-43.895c0-5.868-0.847-10.249-2.541-13.146
c-1.694-2.896-4.8-4.344-9.317-4.344c-4.518,0-7.624,1.448-9.317,4.344c-1.694,2.897-2.541,7.278-2.541,13.146v43.895
C51.25,217.337,52.104,221.831,53.815,224.877z M122.151,241.295c-8.039,0-14.175-2.67-18.41-8.011
c-4.235-5.341-6.602-12.638-7.101-21.891l12.755-3.611c0.631,14.443,4.883,21.665,12.755,21.665c6.377,0,9.566-3.611,9.566-10.832
c0-2.144-0.258-4.127-0.772-5.953c-0.516-1.824-1.304-3.498-2.367-5.021c-1.063-1.523-2.027-2.745-2.89-3.667
c-0.864-0.921-2.043-2.059-3.538-3.413l-15.944-14.443c-2.923-2.596-5.257-5.896-7-9.902c-1.744-4.005-2.616-8.566-2.616-13.682
c0-7.447,2.043-13.371,6.129-17.772c4.085-4.401,9.5-6.601,16.243-6.601c7.241,0,12.996,2.003,17.265,6.008
c4.268,4.006,6.901,9.676,7.897,17.011c0.1,0.79,0.215,1.881,0.349,3.272l-12.755,3.61c-0.033-0.639-0.117-1.598-0.249-2.877
c-0.565-4.588-1.836-8.266-3.812-11.03c-1.977-2.764-4.875-4.146-8.695-4.146c-3.056,0-5.415,0.968-7.075,2.905
c-1.661,1.938-2.491,4.636-2.491,8.096c0,5.68,2.125,10.438,6.378,14.274l15.944,14.443c8.503,7.786,12.755,17.095,12.755,27.928
c0,7.41-2.018,13.202-6.054,17.377C134.383,239.208,128.96,241.295,122.151,241.295z M153.79,240.28V139.177h12.755v43.33h22.322
v-43.33h12.755V240.28h-12.755v-46.941h-22.322v46.941H153.79z M862.941,94.496H629.764v3.958h233.178V94.496z M862.941,273.642
H629.764v3.958h233.178V273.642z M666.641,240.452V136.24h13.179v44.662h23.063V136.24h13.18v104.211h-13.18v-48.384h-23.063v48.384
H666.641z M729.241,240.452V136.24h36.242v11.165H742.42v33.497h16.475v11.165H742.42v37.219h23.063v11.165H729.241z
M773.566,240.452V136.24h13.179v93.046h23.063v11.165H773.566z M815.936,240.452V136.24h23.063
c15.375,0,23.063,9.925,23.063,29.774c0,8.491-1.982,14.956-5.946,19.395c-3.964,4.439-9.67,6.658-17.117,6.658h-9.885v48.384
H815.936z M829.114,180.902h3.295c2.986,0,5.432-0.193,7.336-0.582c1.905-0.387,3.586-1.114,5.045-2.181
c1.459-1.065,2.505-2.587,3.141-4.565c0.635-1.977,0.952-4.497,0.952-7.56c0-3.722-0.24-6.736-0.721-9.042s-1.364-4.196-2.651-5.67
c-1.286-1.473-2.952-2.491-4.993-3.054c-2.042-0.562-4.745-0.843-8.108-0.843h-3.295V180.902z M428.667,16.622
c-92.942,0-168.287,75.345-168.287,168.287s75.345,168.287,168.287,168.287c92.943,0,168.287-75.345,168.287-168.287
S521.61,16.622,428.667,16.622z M354.58,142.224c-0.165-2.386-0.468-4.851-0.909-7.396c-0.442-2.543-1.088-4.659-1.941-6.347
c-0.854-1.685-1.929-3.244-3.222-4.675c-1.295-1.432-2.933-2.481-4.915-3.149c-1.983-0.669-4.295-1.002-6.94-1.002
c-3.415,0-6.347,0.636-8.797,1.908c-2.451,1.273-4.365,2.91-5.741,4.915c-1.378,2.003-2.438,4.692-3.18,8.063
c-0.744,3.373-1.227,6.665-1.446,9.877c-0.22,3.213-0.33,7.174-0.33,11.881v61.075c0,4.072,0.151,7.763,0.455,11.069
c0.302,3.31,0.894,6.602,1.776,9.878c0.879,3.277,2.023,6.028,3.428,8.254c1.403,2.228,3.274,4.025,5.617,5.393
c2.34,1.369,5.08,2.052,8.218,2.052c3.14,0,5.838-0.699,8.097-2.1c2.257-1.399,4.033-3.181,5.328-5.345
c1.293-2.162,2.313-4.929,3.056-8.302c0.743-3.372,1.226-6.648,1.446-9.83c0.219-3.18,0.331-6.87,0.331-11.069v-6.107h21.146v6.107
c0,8.843-0.674,16.604-2.024,23.285c-1.351,6.68-3.525,12.582-6.526,17.702c-3.002,5.122-7.077,9.019-12.226,11.69
c-5.15,2.672-11.358,4.008-18.628,4.008c-6.223,0-11.702-1.019-16.438-3.053c-4.737-2.037-8.619-4.851-11.647-8.446
c-3.029-3.594-5.494-8.079-7.394-13.456c-1.899-5.375-3.235-11.118-4.006-17.226c-0.772-6.106-1.156-13.01-1.156-20.708v-48.764
c0-7.698,0.384-14.602,1.156-20.709c0.771-6.107,2.107-11.848,4.006-17.226c1.9-5.375,4.365-9.844,7.394-13.407
c3.028-3.562,6.91-6.361,11.647-8.397c4.736-2.036,10.215-3.055,16.438-3.055c6.884,0,12.832,1.179,17.843,3.531
c5.011,2.354,9.018,5.821,12.019,10.402c3.002,4.58,5.259,9.893,6.774,15.937c1.514,6.045,2.409,13.107,2.685,21.185
c0.055,1.21,0.083,3.088,0.083,5.631h-21.146v-5.439C354.854,147.49,354.745,144.61,354.58,142.224z M444.292,272.343l-7.933-42.753
h-26.434l-7.93,42.753h-21.147l31.721-171.011h21.147l31.721,171.011H444.292z M536.313,272.343L498.48,158.59v113.753h-21.146
V101.332h15.857l37.01,105.736V101.332h21.147v171.011H536.313z M412.569,211.268h21.147l-10.573-73.29L412.569,211.268z"></path>
</svg>
</a>
</p>

<ul>
<li><a href="/about/">About</a></li>
<li><a href="/archives/all/">All Posts</a></li>
</ul>
</header>

<div class="jch-col jch-col__middle">
{% block content %}{% endblock %}
</div>
<div class="jch-col jch-col__right jch-col__pad-vert">

<ul class="jch-list jch-list__meta">
{%- if layout in [ 'post', 'gallery', 'link', 'post', 'quote', 'status' ] -%}
<li>
<p><strong>Published:</strong></p>
<p>{{ page.date | dateformat }}</p>
</li>

<li>
<p><strong>Tags:</strong></p>
<p>
{%- for tag in tags -%}
{{ tag }}<br>
{%- endfor -%}
</p>
</li>
{%- endif -%}
</ul>
</div>
</section>

<footer class="jch-row jch-row__footer">
<div class="jch-col jch-col__left">&nbsp;</div>
<div class="jch-col jch-col__middle">
<p>Proudly built with <strong>Eleventy</strong></p>
<p>This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>. This means you are free to copy and redistribute the material in any medium or format, and remix, transform, and build upon the material.
</p>
<p>
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a>
</p>

</div>
</footer>
</body>
</html>
19 changes: 15 additions & 4 deletions content/_includes/layouts/all.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@

{% block content %}
<main>
<h1 class="jch-col--col-head">{{ title }}</h1>
{{ content | safe }}
<ul>
<ul class="jch-list jch-list__feed">
{%- for post in collections.postsCollection -%}
<li>
<a href="{{ post.url | safe }}">{{ post.data.title | safe }}</a><br>
<em>{{ post.date }}</em> {{ post.data.excerpt | safe }}<br>
{%- if post.data.featured_img -%}
<img src="{{ post.data.featured_img | safe }}">
<a href="{{ post.url | safe }}">
<img src="{{ post.data.featured_img | safe }}" class="jch-list__posts--img">
</a>
{%- endif -%}
<div class="jch-list__posts--content">
<h2 class="jch-list--title">
<a href="{{ post.url | safe }}">{{ post.data.title | safe }}</a>
</h2>
<p>{{ post.data.excerpt | safe }}</p>
<p class="jch-list__posts--meta">
<strong class="jch-list__posts--live-on">Published: </strong>
<span class="jch-list__posts--date">{{ post.date | dateformat }}</span>
</p>
</div>
</li>
{%- endfor -%}
</ul>
Expand Down
2 changes: 1 addition & 1 deletion content/_includes/layouts/gallery.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "_html.njk" %}

{% block content %}
<main>
<main class="jch-post jch-post--article">
{{ content | safe }}
</main>
{% endblock %}
2 changes: 1 addition & 1 deletion content/_includes/layouts/link.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "_html.njk" %}

<main>
<main class="jch-post jch-post--article">
{% block content %}
{{ content | safe }}
{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion content/_includes/layouts/page.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "_html.njk" %}

{% block content %}
<main>
<main class="jch-post jch-post--article">
{{ content | safe }}
</main>
{% endblock %}
2 changes: 1 addition & 1 deletion content/_includes/layouts/post.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "_html.njk" %}

{% block content %}
<main>
<main class="jch-post jch-post--article">
{{ content | safe }}
</main>
{% endblock %}
2 changes: 1 addition & 1 deletion content/_includes/layouts/quote.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "_html.njk" %}

{% block content %}
<main>
<main class="jch-post jch-post--article">
{{ content | safe }}
<p><a href="{{ link_to | safe }}">&mdash; {{ citation | safe }}</a></p>
</main>
Expand Down
2 changes: 1 addition & 1 deletion content/_includes/layouts/status.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "_html.njk" %}

{% block content %}
<main>
<main class="jch-post jch-post--article">
{{ content | safe }}
</main>
{% endblock %}
13 changes: 11 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
"scripts": {
"11": "npx @11ty/eleventy",
"test": "echo \"Error: no test specified\" && exit 1",
"serve": "npx @11ty/eleventy --serve --watch"
"serve": "npx @11ty/eleventy --serve --watch",
"sass": "node-sass --watch sass -o content/_css"
},
"author": "",
"license": "MIT"
"license": "MIT",
"devDependencies": {
"moment": "^2.24.0"
}
}

0 comments on commit 78b236b

Please sign in to comment.