-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b79046
commit 2981654
Showing
10 changed files
with
2,285 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = function(eleventyConfig) { | ||
|
||
const english = new Intl.DateTimeFormat('en'); | ||
|
||
eleventyConfig.addFilter("dtFormat", function(date) { | ||
return english.format(date); | ||
}); | ||
|
||
eleventyConfig.addFilter("getByURL", function(url, posts) { | ||
return posts.reduce((prev, p) => { | ||
if(p.data.page.url === url) return p; | ||
else return prev; | ||
}); | ||
}); | ||
|
||
eleventyConfig.addFilter("getRelated", function(relatedPosts, posts) { | ||
return relatedPosts.map(p => eleventyConfig.getFilter('getByURL')(p, posts)); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: Blog Demo | ||
--- | ||
<html> | ||
|
||
<head> | ||
<title>{{title}}</title> | ||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> | ||
|
||
<style> | ||
.container { | ||
margin-top:70px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"> | ||
<a class="navbar-brand" href="/">Blog Demo</a> | ||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
</nav> | ||
|
||
<main role="main" class="container"> | ||
|
||
{{ content }} | ||
|
||
</main> | ||
|
||
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> | ||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
layout: layout | ||
--- | ||
|
||
<h2>{{ title }}</h2> | ||
<p><i>Published {{ date | dtFormat }}</i></p> | ||
{% if followup %} | ||
{% assign followupPost = followup | getByURL: collections.posts %} | ||
<p><strong>Followup:</strong> <a href="{{ followupPost.url }}">{{ followupPost.data.title }}</a></p> | ||
{% endif %} | ||
|
||
{{ content }} | ||
|
||
{% if related %} | ||
<h3>Related Posts</h3> | ||
<ul> | ||
{% assign posts = related | getRelated: collections.posts %} | ||
{% for post in posts %} | ||
<li><a href="{{ post.url }}">{{ post.data.title }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
title: Home Page for Blog | ||
layout: layout | ||
--- | ||
|
||
<h2>Blog Demo</h2> | ||
|
||
<p> | ||
This folder is meant to be used as a basic blog that I will copy to use in <i>other</i> demos. | ||
</p> | ||
|
||
<h2>Posts</h2> | ||
|
||
<ul> | ||
{% for post in collections.posts reversed %} | ||
<li><a href="{{post.url}}">{{ post.data.title }}</a> ({{ post.date | dtFormat }})</li> | ||
{% endfor %} | ||
</ul> | ||
|
Oops, something went wrong.