Skip to content

Commit 6b46657

Browse files
authored
Merge pull request #262 from photogabble/patch/update-article-template
Iterative changes to design
2 parents 8400768 + 1690094 commit 6b46657

File tree

8 files changed

+69
-71
lines changed

8 files changed

+69
-71
lines changed

.eleventy.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,15 @@ module.exports = function (eleventyConfig) {
4343
lastXDays: 180,
4444
});
4545

46+
const numberFormat = new Intl.NumberFormat('en-GB');
47+
4648
eleventyConfig.addPlugin(require('@photogabble/eleventy-plugin-word-stats'), {
4749
output: (stats) => {
50+
const words = numberFormat.format(stats.words);
4851
return {
4952
words: stats.words,
5053
time: stats.text,
51-
text: `${stats.words} words, ${stats.text}`
54+
text: `~${words} words, about a ${stats.text}`
5255
};
5356
}
5457
});

_includes/components/growth.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
{% set growthTitle = 'Evergreens are ideas that I have invested a lot of work in. They are in a finished state and unlikely to change over time.' %}
1616
{% set growthText = 'Evergreen' %}
1717
{% endif %}
18-
{{ growthIcon }} <abbr title="{{ growthTitle }}">{{ growthText }}<sup><a href="/glossary/growth/">(?)</a></sup></abbr>
18+
{{ growthIcon }} <abbr title="{{ growthTitle }}">{{ growthText }}</abbr>

_includes/layouts/book.njk

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
{% extends "./page.njk" %}
22
{% set ogtype = 'article' %}
3+
{% set headingClass = 'book' %}
4+
{% set title = book.title %}
5+
{% set titlePrefix = 'Book' %}
6+
{% set subTitle = book.subtitle %}
37

4-
{% block content %}
5-
<article class="book">
6-
<header>
7-
<h1>{{ title }}</h1>
8-
{% if book.subtitle %}
9-
<h2>{{ book.subtitle }}</h2>
10-
{% endif %}
11-
<p><small>{% for author in book.authors %}
12-
{{ author.name }}{{ "," if not loop.last }}
13-
{% endfor %}</small></p>
14-
</header>
15-
<span>
16-
&mdash;
17-
</span>
8+
{% block pageHeader %}
9+
<p><small>{% for author in book.authors %}{{ author.name }}{{ "," if not loop.last }}{% endfor %}</small></p>
10+
{% endblock %}
11+
12+
{% block pageContent %}
1813
<section>
1914
<aside class="margin-note">
2015
{% if book.cover %}
@@ -41,8 +36,5 @@
4136
</aside>
4237
{{ content | safe }}
4338
</section>
44-
4539
{% include "components/backlinks.njk" %}
46-
</article>
47-
4840
{% endblock %}

_includes/layouts/page-post.njk

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{% extends "./page.njk" %}
2+
{% set ogtype = 'article' %}
3+
{% set readingTime = content | wordStats %}
4+
{% set headingClass = 'note' %}
5+
{% set titlePrefix %}
6+
{% include "../components/growth.njk" %} {{ contentType }}
7+
{% endset %}
8+
9+
{% set subTitle %}
10+
planted on <time datetime="{{ page.date.toISOString() }}">{{ page.date | dateToFormat("DDD") }}</time> in: {% for tag in tags | formatTagList %}<a href="/topic/{{ tag.slug }}" title="Visit {{ tag.name }} index">{{ tag.name }}</a>{{ ' and ' if loop.revindex == 2 }}{{ ', ' if loop.revindex > 2 }}{% endfor %}.<br/>{{ readingTime.text if readingTime.words > 0 }}.
11+
{% endset %}
12+
13+
{% block pageHeader %}
14+
15+
{% endblock %}
16+
17+
{% block pageContent %}
18+
{% if growthStage === 'stub' %}
19+
<section>
20+
<blockquote>
21+
<p>Note: This is a stub post to be filled out in the future. It has been created for the purpose of interlinking feel free to check out what links here from the list below to find related pages.</p>
22+
</blockquote>
23+
</section>
24+
{% endif %}
25+
26+
<section>
27+
{{ content | safe }}
28+
</section>
29+
30+
{% if tags | includesTag('wayback machine') %}
31+
<hr/>
32+
{% include "components/wayback-machine.njk" %}
33+
{% endif %}
34+
35+
{% include "components/backlinks.njk" %}
36+
{% endblock %}

_includes/layouts/page.njk

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313
{% block content %}
1414
<article {{ ('class="'+ headingClass +'"') | safe if headingClass }}>
1515
<header>
16-
{% block pageHeader %}
17-
{% if titlePrefix %}<small><span>{{ titlePrefix | safe }}</span></small>{% endif %}
18-
{% if title or headerTitle %}<h1>{{ (title or headerTitle) | safe }}</h1>{% endif %}
19-
{% if subTitle %}<h2>{{ subTitle | safe }}</h2>{% endif %}
20-
{% endblock %}
16+
{% if titlePrefix %}<small><span>{{ titlePrefix | safe }}</span></small>{% endif %}
17+
{% if title or headerTitle %}<h1>{{ (title or headerTitle) | safe }}</h1>{% endif %}
18+
{% if subTitle %}<h2>{{ subTitle | safe }}</h2>{% endif %}
19+
{% block pageHeader %}{% endblock %}
2120
</header>
2221

2322
<span>&mdash;</span>

_includes/layouts/post.njk

Lines changed: 0 additions & 45 deletions
This file was deleted.

content/content.11tydata.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
featured: false,
55
draft: false,
66
excludeFromFeed: false,
7-
layout: 'layouts/post.njk',
7+
layout: 'layouts/page-post.njk',
88
growthStage: 'seedling', // seedling, budding, evergreen
99
contentType: 'thought', // thought, noteworthy, essay, tutorial, project
1010
folder: ['writing'],

styles/main.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,20 @@ main > header > *:first-child{
146146

147147
main > header a {
148148
text-decoration: none;
149+
padding: 0 0.25rem;
150+
}
151+
152+
main > header a:first-child {
153+
padding-left: 0;
149154
}
150155

151156
article > header {
152157
padding: 2em 0 1em 0;
158+
159+
}
160+
161+
article > header h1 {
162+
line-height: 1.1;
153163
}
154164

155165
article > header h1,
@@ -173,7 +183,10 @@ article > header small span{
173183
article > header small + h1 {
174184
margin: 0.67rem 0;
175185
font-size: 3rem;
176-
line-height: 3rem;
186+
}
187+
188+
article.note > header h1 {
189+
font-size: 6rem;
177190
}
178191

179192
article.book > header h1 + h2 {

0 commit comments

Comments
 (0)