Skip to content

Commit 6c710a6

Browse files
Upgraded to Eleventy 3
1 parent 72e77b8 commit 6c710a6

File tree

6 files changed

+74
-67
lines changed

6 files changed

+74
-67
lines changed

.eleventy.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const md = require("markdown-it")({
1212
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
1313
const inclusiveLangPlugin = require("@11ty/eleventy-plugin-inclusive-language");
1414
const pluginRss = require("@11ty/eleventy-plugin-rss");
15+
const UpgradeHelper = require("@11ty/eleventy-upgrade-help");
1516

1617
module.exports = function(eleventyConfig) {
1718
const VOTE_TYPES = ['like-of', 'bookmark-of', 'mention-of'];
@@ -281,8 +282,10 @@ module.exports = function(eleventyConfig) {
281282
.filter( item => item.inputPath.match(/\/wants\/.*\.md/) !== null )
282283
.sort( (a, b) => b.date - a.date )
283284
// append the raw content
284-
.map( item => {
285-
item.data.rawMarkdown = item.template.frontMatter.content.trim() || "";
285+
.map(async (item) => {
286+
const template = await item.template.read();
287+
item.data.rawMarkdown = template.content.trim() || "";
288+
item.data.date_iso = template.data.date.toISOString();
286289
return item;
287290
} );
288291
});
@@ -525,7 +528,7 @@ module.exports = function(eleventyConfig) {
525528

526529
eleventyConfig.addPlugin(pluginRss);
527530

528-
//eleventyConfig.addPlugin(inclusiveLangPlugin);
531+
eleventyConfig.addPlugin(UpgradeHelper);
529532

530533
return {
531534
templateFormats: ["md", "njk", "html", "liquid"],

_includes/components/head.njk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@
3434
<script src="{{ js }}"></script>
3535
{% endfor %}
3636
{% endif %}
37+
38+
<meta name="generator" content="Eleventy">
3739
</head>

_includes/layouts/want.njk

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,22 @@ javascript:
9494

9595
<dl class="want__share">
9696
<dt>Do you want this too? Share it!</dt>
97-
<dd>
98-
<a class="share-link share-link--twitter" href="https://twitter.com/intent/tweet?original_referer={{ absoluteUrl }}&amp;source=tweetbutton&amp;url={{ absoluteUrl }}&amp;text={{ url_title }}&amp;via=webwewantfyi">
99-
<svg class="share-link__icon" xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28"><path d="M24.253 8.756C24.69 17.08 18.297 24.182 9.97 24.62c-3.122.162-6.22-.646-8.86-2.32 2.702.18 5.375-.648 7.507-2.32-2.072-.248-3.818-1.662-4.49-3.64.802.13 1.62.077 2.4-.154-2.482-.466-4.312-2.586-4.412-5.11.688.276 1.426.408 2.168.387-2.135-1.65-2.73-4.62-1.394-6.965C5.574 7.816 9.54 9.84 13.802 10.07c-.842-2.738.694-5.64 3.434-6.48 2.018-.624 4.212.043 5.546 1.682 1.186-.213 2.318-.662 3.33-1.317-.386 1.256-1.248 2.312-2.4 2.942 1.048-.106 2.07-.394 3.02-.85-.458 1.182-1.343 2.15-2.48 2.71z"></path></svg>
100-
<b class="share-link__text">Share on Twitter</b>
101-
</a>
102-
<a class="share-link share-link--facebook" href="http://www.facebook.com/sharer.php?u={{ absoluteUrl }}">
103-
<svg class="share-link__icon" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" width="29" height="29" viewBox="0 0 29 29"><path d="M26.4 0H2.6C1.714 0 0 1.715 0 2.6v23.8c0 .884 1.715 2.6 2.6 2.6h12.393V17.988h-3.996v-3.98h3.997v-3.062c0-3.746 2.835-5.97 6.177-5.97 1.6 0 2.444.173 2.845.226v3.792H21.18c-1.817 0-2.156.9-2.156 2.168v2.847h5.045l-.66 3.978h-4.386V29H26.4c.884 0 2.6-1.716 2.6-2.6V2.6c0-.885-1.716-2.6-2.6-2.6z" fill-rule="evenodd" class="cls-2"></path></svg>
104-
<b class="share-link__text">Post on Facebook</b>
105-
</a>
106-
<a class="share-link share-link--linkedin" href="https://www.linkedin.com/cws/share?url={{ absoluteUrl }}&amp;original_referer={{ absoluteUrl }}">
107-
<svg class="share-link__icon" xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28"><path d="M25.424 15.887v8.447h-4.896v-7.882c0-1.98-.71-3.33-2.48-3.33-1.354 0-2.158.91-2.514 1.802-.13.315-.162.753-.162 1.194v8.216h-4.9s.067-13.35 0-14.73h4.9v2.087c-.01.017-.023.033-.033.05h.032v-.05c.65-1.002 1.812-2.435 4.414-2.435 3.222 0 5.638 2.106 5.638 6.632zM5.348 2.5c-1.676 0-2.772 1.093-2.772 2.54 0 1.42 1.066 2.538 2.717 2.546h.032c1.71 0 2.77-1.132 2.77-2.546C8.056 3.593 7.02 2.5 5.344 2.5h.005zm-2.48 21.834h4.896V9.604H2.867v14.73z"></path></svg>
108-
<b class="share-link__text">Share on LinkedIn</b>
109-
</a>
110-
</dd>
97+
<script>
98+
var $want__share = document.querySelector('.want__share');
99+
var url = '{{ absoluteUrl }}';
100+
var title = '{{ title | urlencode }}';
101+
var text = '{{ description | striptags | truncate( 140 ) | urlencode }}';
102+
var $button = document.createElement('button');
103+
$button.className = 'button button--share';
104+
$button.onlick = function() {
105+
navigator.share({
106+
title: title,
107+
text: text,
108+
url: url
109+
});
110+
}
111+
$want__share.appendChild($button);
112+
</script>
111113
</dl>
112114

113115
<dl class="want__votes">

feeds/wants-json.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ eleventyExcludeFromCollections: true
1313
"id": "{{ want.fileSlug }}",
1414
"title": "{{ want.data.title }}",
1515
"url": "{{ pkg.url }}{{ want.url }}",
16-
"date_published": "{{ want.date.toISOString() }}",
16+
"date_published": "{{ want.date_iso }}",
1717
"tags": [{% for tag in want.data.tags %}"{{ tag }}"{% if not loop.last %},{% endif %}{% endfor %}],
1818
{% if want.data.discussion %}"external_url": "{{ want.data.discussion }}",{% endif %}
1919
"content_text": "{{ want.data.rawMarkdown | replace("\\", "&#92;") | replace("\n", "\\n") | replace("\r", "") }}",

package.json

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
{
2-
"name": "webwewant-fyi",
3-
"title": "The Web We Want",
4-
"description": "A project to gather information about what you need to realize your vision for the web.",
5-
"url": "https://webwewant.fyi",
6-
"version": "1.0.0",
7-
"scripts": {
8-
"start": "npx eleventy --serve",
9-
"build": "npx eleventy",
10-
"watch": "npx eleventy --watch",
11-
"debug": "DEBUG=* npx eleventy"
12-
},
13-
"repository": {
14-
"type": "git",
15-
"url": "https://github.com/WebWeWant/webwewant.fyi"
16-
},
17-
"author": {
18-
"name": "Aaron Gustafson",
19-
"email": "[email protected]",
20-
"url": "https://www.aaron-gustafson.com/"
21-
},
22-
"license": "MIT",
23-
"bugs": {
24-
"url": "https://github.com/aarongustafson/webwewant.fyi/issues"
25-
},
26-
"homepage": "https://webwewant.fyi",
27-
"devDependencies": {
28-
"@11ty/eleventy": "^1.0.1",
29-
"@11ty/eleventy-plugin-inclusive-language": "^1.0.3",
30-
"@11ty/eleventy-plugin-rss": "^1.2.0",
31-
"dotenv": "^8.6.0",
32-
"lodash": "^4.17.21",
33-
"luxon": "^1.26.0",
34-
"markdown-it": "^13.0.1",
35-
"markdown-it-anchor": "^8.6.4",
36-
"node-fetch": "^2.6.1",
37-
"sanitize-html": "^2.3.3",
38-
"widont": "^0.3.3"
39-
},
40-
"dependencies": {
41-
"@11ty/eleventy-plugin-syntaxhighlight": "^4.1.0",
42-
"@types/markdown-it": "^12.2.3",
43-
"bufferutil": "^4.0.3",
44-
"clean-css": "^4.2.3",
45-
"html-minifier": "^4.0.0",
46-
"striptags": "^3.1.1",
47-
"uglify-js": "^3.16.2",
48-
"utf-8-validate": "^5.0.5"
49-
}
2+
"name": "webwewant-fyi",
3+
"title": "The Web We Want",
4+
"description": "A project to gather information about what you need to realize your vision for the web.",
5+
"url": "https://webwewant.fyi",
6+
"version": "1.0.0",
7+
"scripts": {
8+
"start": "npx eleventy --serve",
9+
"build": "npx eleventy",
10+
"watch": "npx eleventy --watch",
11+
"debug": "DEBUG=* npx eleventy"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/WebWeWant/webwewant.fyi"
16+
},
17+
"author": {
18+
"name": "Aaron Gustafson",
19+
"email": "[email protected]",
20+
"url": "https://www.aaron-gustafson.com/"
21+
},
22+
"license": "MIT",
23+
"bugs": {
24+
"url": "https://github.com/aarongustafson/webwewant.fyi/issues"
25+
},
26+
"homepage": "https://webwewant.fyi",
27+
"devDependencies": {
28+
"@11ty/eleventy": "^3.0.0",
29+
"@11ty/eleventy-plugin-inclusive-language": "^1.0.3",
30+
"@11ty/eleventy-plugin-rss": "^1.2.0",
31+
"dotenv": "^8.6.0",
32+
"lodash": "^4.17.21",
33+
"luxon": "^1.26.0",
34+
"markdown-it": "^13.0.1",
35+
"markdown-it-anchor": "^8.6.4",
36+
"node-fetch": "^2.6.1",
37+
"sanitize-html": "^2.3.3",
38+
"widont": "^0.3.3"
39+
},
40+
"dependencies": {
41+
"@11ty/eleventy-plugin-syntaxhighlight": "^4.1.0",
42+
"@types/markdown-it": "^12.2.3",
43+
"bufferutil": "^4.0.3",
44+
"clean-css": "^4.2.3",
45+
"html-minifier": "^4.0.0",
46+
"striptags": "^3.1.1",
47+
"uglify-js": "^3.16.2",
48+
"utf-8-validate": "^5.0.5"
49+
}
5050
}

wants/tagged.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pagination:
44
size: 1
55
alias: tag
66
layout: layouts/base.njk
7-
renderData:
7+
eleventyComputed:
88
title: Wants Tagged “{{ tag | unslug | fixNames }}
99
permalink: /wants/tagged/{{ tag }}/
1010
---

0 commit comments

Comments
 (0)