Skip to content

Commit

Permalink
new demo
Browse files Browse the repository at this point in the history
  • Loading branch information
cfjedimaster committed Aug 29, 2023
1 parent 1b79046 commit 2981654
Show file tree
Hide file tree
Showing 10 changed files with 2,285 additions and 0 deletions.
19 changes: 19 additions & 0 deletions funwithfrontmatter2/.eleventy.js
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));
});
};
37 changes: 37 additions & 0 deletions funwithfrontmatter2/_includes/layout.liquid
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>
22 changes: 22 additions & 0 deletions funwithfrontmatter2/_includes/post.liquid
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 %}
19 changes: 19 additions & 0 deletions funwithfrontmatter2/index.liquid
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>

Loading

0 comments on commit 2981654

Please sign in to comment.