forked from artlung/blogofthe.day
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
26 lines (25 loc) · 1.01 KB
/
.eleventy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("assets/js");
eleventyConfig.addPassthroughCopy("feed.xml");
eleventyConfig.addShortcode("blogToday", function() {
const fs = require('fs');
const dates = require('./dates.json');
const sites = require('./sites.json');
const today = new Date().toISOString().split('T')[0];
return dates.dates[today];
});
eleventyConfig.addShortcode("protocolToday", function() {
const fs = require('fs');
const dates = require('./dates.json');
const httpSites = require('./http-sites.json');
const today = new Date().toISOString().split('T')[0];
const site = dates.dates[today];
const protocol = httpSites.sites.includes(site) ? 'http://' : 'https://';
return protocol;
});
eleventyConfig.addShortcode("blogsByDate", function() {
const fs = require('fs');
const dates = require('./dates.json');
return dates.dates;
});
};