More homepage work, show recent posts
This commit is contained in:
parent
c12d926f01
commit
b10856ab6c
5
config/filters/dates.js
Normal file
5
config/filters/dates.js
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = function(eleventyConfig) {
|
||||
eleventyConfig.addFilter('dateDisplay', date => new Date(date).toLocaleDateString('en-GB', {
|
||||
"dateStyle": "short"
|
||||
}));
|
||||
}
|
@ -1 +1,5 @@
|
||||
module.exports = function() {}
|
||||
const dateFilters = require('./dates');
|
||||
|
||||
module.exports = function(eleventyConfig) {
|
||||
eleventyConfig.addPlugin(dateFilters);
|
||||
}
|
11
src/blog/posts/fourth-post.md
Normal file
11
src/blog/posts/fourth-post.md
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
title: My fourth post
|
||||
---
|
||||
|
||||
Something something something
|
||||
|
||||
## Something else
|
||||
|
||||
Some content in here
|
||||
|
||||
### A sub-subheading
|
11
src/blog/posts/second-post.md
Normal file
11
src/blog/posts/second-post.md
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
title: My second post
|
||||
---
|
||||
|
||||
Something something something
|
||||
|
||||
## Something else
|
||||
|
||||
Some content in here
|
||||
|
||||
### A sub-subheading
|
11
src/blog/posts/third-post.md
Normal file
11
src/blog/posts/third-post.md
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
title: My third post
|
||||
---
|
||||
|
||||
Something something something
|
||||
|
||||
## Something else
|
||||
|
||||
Some content in here
|
||||
|
||||
### A sub-subheading
|
@ -2,22 +2,38 @@
|
||||
margin-block-start: var(--vertical-spacing, 1.5rem);
|
||||
}
|
||||
|
||||
.stack-sm {
|
||||
.stack-4xs > * + * {
|
||||
--vertical-spacing: var(--space-size-4xs);
|
||||
}
|
||||
|
||||
.stack-3xs > * + * {
|
||||
--vertical-spacing: var(--space-size-3xs);
|
||||
}
|
||||
|
||||
.stack-2xs > * + * {
|
||||
--vertical-spacing: var(--space-size-2xs);
|
||||
}
|
||||
|
||||
.stack-xs > * + * {
|
||||
--vertical-spacing: var(--space-size-xs);
|
||||
}
|
||||
|
||||
.stack-sm > * + * {
|
||||
--vertical-spacing: var(--space-size-s);
|
||||
}
|
||||
|
||||
.stack-md {
|
||||
.stack-md > * + * {
|
||||
--vertical-spacing: var(--space-size-m);
|
||||
}
|
||||
|
||||
.stack-lg {
|
||||
.stack-lg > * + * {
|
||||
--vertical-spacing: var(--space-size-l);
|
||||
}
|
||||
|
||||
.stack-xl {
|
||||
.stack-xl > * + * {
|
||||
--vertical-spacing: var(--space-size-xl);
|
||||
}
|
||||
|
||||
.stack-2xl {
|
||||
.stack-2xl > * + * {
|
||||
--vertical-spacing: var(--space-size-2xl);
|
||||
}
|
||||
|
@ -16,4 +16,12 @@
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
time {
|
||||
color: var(--color-zinc-300);
|
||||
display: block;
|
||||
font-size: var(--text-size-s);
|
||||
font-style: italic;
|
||||
font-weight: 300;
|
||||
}
|
||||
}
|
||||
|
@ -67,8 +67,8 @@ p {
|
||||
}
|
||||
|
||||
footer {
|
||||
padding-top: var(--space-size-l);
|
||||
width: 100vw;
|
||||
padding: var(--space-size-l) 0 var(--space-size-s);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 50em) {
|
||||
|
@ -20,9 +20,15 @@ layout: base.njk
|
||||
</p>
|
||||
|
||||
</section>
|
||||
<section>
|
||||
<section class="stack-md">
|
||||
<h2>Recent Posts</h2>
|
||||
|
||||
<a href="/blog">View more posts</a>
|
||||
<ul class="stack-2xs">
|
||||
{% for post in collections.posts.slice(0, 3) %}
|
||||
<li><a href="{{ post.data.url }}">{{ post.data.title }}</a> <time>{{ post.date | dateDisplay }}</time></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<a href="/blog" class="block">View more posts</a>
|
||||
</section>
|
||||
</main>
|
||||
|
Loading…
Reference in New Issue
Block a user