Skip to content
Permalink
Browse files

Initial version of the homepage

  • Loading branch information...
JonUK committed May 31, 2019
1 parent 31a53b0 commit 0763a1c99e4fbaa5b6b14a6998a535e15f9e7b1b
Showing with 57 additions and 1 deletion.
  1. +14 −0 .eleventy.js
  2. +16 −0 index.njk
  3. +6 −0 package-lock.json
  4. +2 −1 package.json
  5. +9 −0 posts/2019/blog-post-1.md
  6. +10 −0 posts/2019/blog-post-2.md
@@ -0,0 +1,14 @@
const moment = require('moment');

moment.locale('en');

module.exports = function (eleventyConfig) {

eleventyConfig.addFilter('dateIso', date => {
return moment(date).toISOString();
});

eleventyConfig.addFilter('dateReadable', date => {
return moment(date).format('LL'); // E.g. May 31, 2019
});
};
@@ -0,0 +1,16 @@
---
layout: base-layout.njk
pagination:
data: collections.post
size: 10
reverse: true
alias: posts
---
{% for post in posts %}
<article>
<h1>
<a href="{{ post.url | url }}">{{ post.data.title }}</a>
</h1>
<time datetime="{{ post.date | dateIso }}">{{ post.date | dateReadable }}</time>
</article>
{% endfor %}

Some generated files are not rendered by default. Learn more.

@@ -18,6 +18,7 @@
},
"homepage": "https://github.com/JonUK/eleventy-blog#readme",
"devDependencies": {
"@11ty/eleventy": "^0.8.3"
"@11ty/eleventy": "^0.8.3",
"moment": "^2.24.0"
}
}
@@ -0,0 +1,9 @@
---
layout: base-layout.njk
title: This Is My First Ever Post
date: 2019-05-30
tags: ['post']
---
This is the first post on my blog.

Eleventy is super fresh init.
@@ -0,0 +1,10 @@
---
layout: base-layout.njk
title: How To Get Rich Quick
date: 2019-06-01
tags: ['post']
---
Buy the latest and greatest cryptocurrency that no-one has heard of.

## Legal Stuff
We do not accept any liability for any loss or damage.

0 comments on commit 0763a1c

Please sign in to comment.
You can’t perform that action at this time.