Skip to content
This repository was archived by the owner on May 2, 2021. It is now read-only.

Commit 925b10e

Browse files
authored
Merge pull request #23 from fevrcoding/eleventy
Migration to Eleventy
2 parents a8f9a77 + 08998d3 commit 925b10e

765 files changed

Lines changed: 13042 additions & 2983 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eleventy.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
const yaml = require('js-yaml');
2+
const rss = require('@11ty/eleventy-plugin-rss');
3+
const { DateTime } = require('luxon');
4+
5+
module.exports = function(eleventyConfig) {
6+
const assets = ['js', 'css', 'fonts', 'img', 'odx-assets', 'admin'];
7+
8+
for (const folder of assets) {
9+
eleventyConfig.addPassthroughCopy({ [`static/${folder}`]: folder });
10+
}
11+
12+
eleventyConfig.addPlugin(rss);
13+
14+
eleventyConfig.addPassthroughCopy({ 'static/*.*': '.' });
15+
16+
eleventyConfig.addDataExtension('yaml', (contents) =>
17+
yaml.safeLoad(contents),
18+
);
19+
20+
eleventyConfig.addNunjucksFilter('dateformat', (date, format) => {
21+
return DateTime.fromJSDate(date, { zone: 'utc' }).toFormat(format);
22+
});
23+
24+
eleventyConfig.addFilter('dateslug', (date) => {
25+
return DateTime.fromJSDate(date, { zone: 'utc' }).toFormat('yyyy/LL');
26+
});
27+
28+
eleventyConfig.addNunjucksFilter('published', (posts) => {
29+
return posts.filter((post) => post.data.published);
30+
});
31+
32+
eleventyConfig.addNunjucksFilter('limit', (posts, num) => {
33+
return posts.slice(0, num);
34+
});
35+
36+
eleventyConfig.addNunjucksFilter('featuredEvent', (posts) => {
37+
// return a featured event or the first one
38+
return posts.find(({ data }) => data.featured) || posts[0];
39+
});
40+
41+
// redirect collection
42+
eleventyConfig.addCollection('redirects', function(collection) {
43+
const redirs = collection.getAll().filter(({ data }) => data.redirect_from);
44+
const redirects = new Map();
45+
for (item of redirs) {
46+
let { redirect_from } = item.data;
47+
if (!Array.isArray(redirect_from)) {
48+
redirect_from = [redirect_from];
49+
}
50+
redirect_from.forEach((from) => {
51+
redirects.set(from, {
52+
from,
53+
to: item.url,
54+
});
55+
});
56+
}
57+
return [...redirects.values()];
58+
});
59+
60+
return {
61+
htmlTemplateEngine: 'njk',
62+
dir: {
63+
includes: '_includes',
64+
layouts: '_layouts',
65+
input: 'src',
66+
output: '_site',
67+
},
68+
};
69+
};

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dist
2+
package.json
3+
node_modules
4+
js
5+
css
6+
fonts
7+
odx-assets

.eslintrc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"root": true,
3+
"extends": [
4+
"eslint:recommended",
5+
"plugin:node/recommended",
6+
"plugin:prettier/recommended"
7+
],
8+
"env": {
9+
"node": true
10+
},
11+
"rules": {
12+
"no-console": 0,
13+
"node/no-unpublished-require": 0,
14+
"no-shadow": "warn",
15+
"block-scoped-var": "error",
16+
"consistent-return": "error",
17+
"eqeqeq": "error"
18+
}
19+
}

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dist
2+
package.json
3+
node_modules
4+
js
5+
css
6+
fonts
7+
odx-assets

.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
trailingComma: 'all',
3+
arrowParens: 'always',
4+
semi: true,
5+
singleQuote: true,
6+
};

Gemfile

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

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
# Fevr Jekyll site
1+
# FEVR Eleventy site
22

33
This is the new Fevr static website.
44

55
## Usage
6-
build with `bundle exec jekyll serve`
6+
7+
```
8+
npm install
9+
10+
# development
11+
npm run serve
12+
13+
# production
14+
npm run build
15+
```

_config.yml

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

0 commit comments

Comments
 (0)