Skip to content

Commit 5ec49e7

Browse files
authored
Merge pull request #20 from Node-Study-Guide/authors
Adding authors and last modified date display
2 parents 9f86f93 + 27c9eb4 commit 5ec49e7

File tree

8 files changed

+120
-61
lines changed

8 files changed

+120
-61
lines changed

.eleventy.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1+
const moment = require("moment");
2+
3+
moment.locale("en");
4+
15
module.exports = function(eleventyConfig) {
6+
eleventyConfig.addFilter("dateIso", date => {
7+
return moment(date).toISOString();
8+
});
9+
10+
eleventyConfig.addFilter("dateReadable", date => {
11+
return moment(date).format("LL"); // E.g. May 31, 2019
12+
});
13+
214
eleventyConfig.addPassthroughCopy("css");
315
eleventyConfig.addPassthroughCopy("js");
416
eleventyConfig.addPassthroughCopy("CNAME");

_data/authors.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"john": {
3+
"name": "John Behan",
4+
"link": "/about/#john"
5+
},
6+
"ian": {
7+
"name": "Ian Read",
8+
"link": "/about/#ian"
9+
},
10+
"donovan": {
11+
"name": "Donovan Hutchinson",
12+
"link": "/about/#donovan"
13+
}
14+
}

_includes/base.njk

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: OpenJS NodeJS Application Developer Study Guide
3+
---
4+
<!doctype html>
5+
<html lang="en">
6+
<head>
7+
<meta charset="utf-8">
8+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
9+
<title>{{ title }}</title>
10+
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
11+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.css">
12+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.css">
13+
<link rel="stylesheet" href="{{ "/css/main.css" | url }}">
14+
<link rel="stylesheet"
15+
href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.16.2/build/styles/default.min.css">
16+
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.16.2/build/highlight.min.js"></script>
17+
<script>
18+
hljs.initHighlightingOnLoad();
19+
</script>
20+
<script src="{{ "/js/main.js" | url }}"></script>
21+
</head>
22+
<body>
23+
<header class="container">
24+
<div class="row">
25+
<div class="column column-50">
26+
<h1 class="logo">
27+
<a href="/">ONAD Study Guide</a>
28+
</h1>
29+
</div>
30+
<div class="top-links column column-50">
31+
<ul>
32+
<li>
33+
<a href="https://training.linuxfoundation.org/certification/jsnad/" target="_blank" title="OpenJS Node.js Application Developer (JSNAD)">JSNAD Certification</a>
34+
</li>
35+
</ul>
36+
</div>
37+
</div>
38+
</header>
39+
<main class="container">
40+
<div class="row">
41+
<div class="sidebar column">
42+
<nav>
43+
<ul class="topics">
44+
{% for topic in topics %}
45+
<li data-topic="{{topic.url}}">
46+
<a href="{{ topic.url | url }}" {% if page.url === topic.url %} class="current" {% endif %}>{{topic.title}}</a>
47+
</li>
48+
{% endfor %}
49+
</ul>
50+
</nav>
51+
</div>
52+
<div class="main-content column column-75">
53+
{{ content | safe }}
54+
</div>
55+
</div>
56+
</main>
57+
<footer class="container">
58+
<div class="row">
59+
<div class="column column-75 column-offset-25">
60+
<p>
61+
<a href="https://github.com/Node-Study-Guide/openjs-nodejs-application-developer-study-guide/tree/master/{{ page.inputPath }}">Edit this page on GitHub</a>
62+
</p>
63+
</div>
64+
</div>
65+
66+
</footer>
67+
</body>
68+
</html>

_includes/default.njk

Lines changed: 6 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,8 @@
11
---
2-
title: OpenJS NodeJS Application Developer Study Guide
2+
layout: base.njk
3+
templateClass: tmpl-post
34
---
4-
<!doctype html>
5-
<html lang="en">
6-
<head>
7-
<meta charset="utf-8">
8-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
9-
<title>{{ title }}</title>
10-
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,300italic,700,700italic">
11-
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.css">
12-
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.css">
13-
<link rel="stylesheet" href="{{ "/css/main.css" | url }}">
14-
<link rel="stylesheet"
15-
href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.16.2/build/styles/default.min.css">
16-
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.16.2/build/highlight.min.js"></script>
17-
<script>hljs.initHighlightingOnLoad();</script>
18-
<script src="{{ "/js/main.js" | url }}"></script>
19-
</head>
20-
<body>
21-
<header class="container">
22-
<div class="row">
23-
<div class="column column-50">
24-
<h1 class="logo"><a href="/">ONAD Study Guide</a></h1>
25-
</div>
26-
<div class="top-links column column-50">
27-
<ul>
28-
<li><a href="https://training.linuxfoundation.org/certification/jsnad/" target="_blank" title="OpenJS Node.js Application Developer (JSNAD)">JSNAD Certification</a></li>
29-
</ul>
30-
</div>
31-
</div>
32-
</header>
33-
<main class="container">
34-
<div class="row">
35-
<div class="sidebar column">
36-
<nav>
37-
<ul class="topics">
38-
{% for topic in topics %}
39-
<li data-topic="{{topic.url}}">
40-
<a href="{{ topic.url | url }}" {% if page.url === topic.url %} class="current" {% endif %}>{{topic.title}}</a>
41-
</li>
42-
{% endfor %}
43-
</ul>
44-
</nav>
45-
</div>
46-
<div class="main-content column column-75">
47-
<h1>{{ title }}</h1>
48-
{{ content | safe }}
49-
</div>
50-
</div>
51-
</main>
52-
<footer class="container">
53-
<div class="row">
54-
<div class="column column-75 column-offset-25">
55-
<p><a href="https://github.com/Node-Study-Guide/openjs-nodejs-application-developer-study-guide/tree/master/{{ page.inputPath }}">Edit this page on GitHub</a></p>
56-
</div>
57-
</div>
58-
59-
</footer>
60-
</body>
61-
</html>
5+
6+
<h1>{{ title }}</h1>
7+
8+
{{ content | safe }}

_includes/post.njk

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
---
2-
layout: default.njk
2+
layout: base.njk
33
templateClass: tmpl-post
44
---
55

6+
<h1>{{ title }}</h1>
7+
8+
<p class="metadata">
9+
<span class="author">Author: <a href="{{ authors[author].link | url }}">{{authors[author].name}}</a>
10+
</span>
11+
<br/>
12+
<time datetime="{{ date | dateIso }}">{{ date | dateReadable }}</time>
13+
</p>
14+
615
{{ content | safe }}
716

817
<h3>Ready to mark {{title}} as completed?</h3>

events/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
layout: post.njk
33
title: Events
44
url: events
5+
author: ian
6+
date: 2019-11-09
57
---
68

79
The Node.js core API is built around the idea of events being "emitted" and "listened" to. Objects called "emitters" emit _named_ events, that are picked up by "listener" functions.

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@11ty/eleventy": "^0.9.0"
2121
},
2222
"devDependencies": {
23-
"gh-pages": "^2.1.1"
23+
"gh-pages": "^2.1.1",
24+
"moment": "^2.24.0"
2425
}
2526
}

0 commit comments

Comments
 (0)