Skip to content

Commit 8149ea2

Browse files
Pulling in latest before merge
2 parents 04fbaa2 + 129a4ce commit 8149ea2

Some content is hidden

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

73 files changed

+3911
-269
lines changed

netlify.toml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,24 @@
1212

1313
[[redirects]]
1414
from = "/conference"
15-
to = "https://jamstackconf.com/"
15+
to = "/conf"
16+
status = 301
17+
18+
[[redirects]]
19+
from = "/conf"
20+
to = "https://jamstackconf.com/conf/"
21+
status = 200
22+
23+
[[redirects]]
24+
from = "/conf/cfp"
25+
to = "https://docs.google.com/forms/d/e/1FAIpQLSc-z50GyD7zXzr_JCn2M1NBFZ-h65kSdu7zn43V1u2qAKO3ew/viewform"
1626
status = 302
1727

28+
[[redirects]]
29+
from = "/conf/*"
30+
to = "https://jamstackconf.com/conf/:splat"
31+
status = 200
32+
1833
[[redirects]]
1934
from = "/discord"
2035
to = "https://discord.gg/jamstack"
@@ -45,16 +60,6 @@
4560
to = "https://res.cloudinary.com/netlify/image/fetch/c_fit,l_text:Roboto_56_bold::term,co_rgb:FFFFFF,g_north_west,y_75,x_100,w_1000/c_fit,l_text:Roboto_38_light::summary,co_rgb:FFFFFF,g_north_west,y_200,x_160,w_885/https://jamstack.org/img/og/glossary-card-bg.png"
4661
status = 200
4762

48-
[[redirects]]
49-
from = "/conf/"
50-
to = "https://jamstackconf.com/"
51-
status = 302
52-
53-
[[redirects]]
54-
from = "/conf/cfp"
55-
to = "https://docs.google.com/forms/d/e/1FAIpQLSeR5W4m9owqDBJEq2EuRUNXFTOeLCxFPUn0qbuCE15o4SWDFg/viewform"
56-
status = 302
57-
5863
[[redirects]]
5964
from = "/glossary/*"
6065
to = "/glossary/contribute/index.html"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require('dotenv').config();
2+
3+
module.exports = {
4+
appId: 'VGOL4P01VV',
5+
indexName: 'jamstack',
6+
// It’s okay to have this in the repo, it’s used in the clientside JS
7+
searchOnlyApiKey: "a457b566acbf454a61eaaae2e4fee0bf",
8+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
require("@11ty/eleventy");
2+
require("js-yaml");
3+
require("lodash");
4+
require("luxon");
5+
require("markdown-it");
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
require("@11ty/eleventy-cache-assets");
2+
require("dotenv");
3+
require("fast-glob");
4+
require("gray-matter");
5+
require("node-fetch");
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require("./eleventy-app-config-modules.js");
2+
require("./eleventy-app-globaldata-modules.js");
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"/community/": "./src/site/community.njk"
3+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"dir": {
3+
"input": "src/site",
4+
"data": "src/site/_data",
5+
"includes": "src/site/_includes",
6+
"output": "dist"
7+
}
8+
}
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
const lodashGet = require("lodash/get");
2+
const yaml = require("js-yaml");
3+
const { EleventyServerlessBundlerPlugin } = require("@11ty/eleventy");
4+
5+
module.exports = function (eleventyConfig) {
6+
// Support yaml data files
7+
eleventyConfig.addDataExtension("yaml", contents => yaml.safeLoad(contents))
8+
9+
eleventyConfig.addWatchTarget("src/site/survey/**/*.js");
10+
11+
// ODB for Discord events
12+
eleventyConfig.addPlugin(EleventyServerlessBundlerPlugin, {
13+
name: "community",
14+
functionsDir: './netlify/functions',
15+
inputDir: "./src/site",
16+
redirects: "netlify-toml-builders",
17+
copy: ["algolia.config.js"]
18+
});
19+
20+
21+
// pass images directly through to the output
22+
eleventyConfig.addPassthroughCopy("src/site/img");
23+
eleventyConfig.addPassthroughCopy({
24+
"src/js": "js",
25+
"node_modules/@zachleat/filter-container/*.js": "js",
26+
"src/css": "css",
27+
});
28+
29+
// Date helper
30+
const { DateTime } = require('luxon');
31+
eleventyConfig.addFilter('formatDate', (dateObj, formatStr) => {
32+
// convert any date strings to read dates
33+
if (typeof (dateObj) == "string") {
34+
dateObj = new Date(dateObj);
35+
}
36+
const format = formatStr ? formatStr : 'LLLL d, y';
37+
return DateTime.fromJSDate(dateObj, {
38+
zone: 'utc'
39+
}).toFormat(format);
40+
});
41+
42+
// A handy markdown shortcode for blocks of markdown
43+
// coming from our data sources
44+
const markdownIt = require('markdown-it');
45+
const md = new markdownIt({
46+
html: true
47+
});
48+
eleventyConfig.addPairedShortcode('markdown', (content) => {
49+
return md.render(content);
50+
});
51+
52+
53+
eleventyConfig.addFilter('convertFromEpoc', (time) => {
54+
let date = new Date(0);
55+
return date.setUTCSeconds(time);
56+
});
57+
58+
59+
eleventyConfig.addCollection("resources", function (collectionApi) {
60+
return collectionApi.getFilteredByGlob("src/site/resources/*.md");
61+
});
62+
63+
64+
// Filter a collection based on items flagged as "featured"
65+
eleventyConfig.addFilter('featured', (items) => {
66+
return items.filter(item => item.data.featured);
67+
});
68+
69+
// Filter a collection based on the value of a data attribute
70+
eleventyConfig.addFilter('dataAttr', (items, attr, value) => {
71+
return items.filter(item => item.data[attr] == value);
72+
});
73+
74+
// Filter a collection based on the value of a data attribute
75+
eleventyConfig.addFilter('whereData', (items, expression) => {
76+
let key = expression.split('=')[0];
77+
let val = expression.split('=')[1];
78+
return items.filter(item => item.data[key] == val);
79+
});
80+
81+
82+
83+
84+
// filter a data array based on the value of a property
85+
eleventyConfig.addFilter('select', (array, clause) => {
86+
if (clause.indexOf("=") > -1) {
87+
const property = clause.split("=")[0];
88+
const value = clause.split("=")[1];
89+
return array.filter(item => lodashGet(item, property).includes(value));
90+
} else {
91+
return array.map(item => lodashGet(item, clause));
92+
}
93+
});
94+
95+
eleventyConfig.addFilter('flatten', (array) => {
96+
let results = [];
97+
for (let result of array) {
98+
if (result) {
99+
if (Array.isArray(result)) {
100+
results = [...results, ...result];
101+
} else {
102+
results.push(result);
103+
}
104+
}
105+
}
106+
return results;
107+
});
108+
109+
eleventyConfig.addFilter('unique', (array) => {
110+
let caseInsensitive = {};
111+
for (let val of array) {
112+
if (typeof val === "string") {
113+
caseInsensitive[val.toLowerCase()] = val;
114+
}
115+
}
116+
return Object.values(caseInsensitive);
117+
});
118+
119+
// Get a random selection of items from an array
120+
eleventyConfig.addFilter('luckydip', (array, count) => {
121+
if (count > array.length) {
122+
count = array.length;
123+
}
124+
const shuffled = array.sort(() => 0.5 - Math.random());
125+
return shuffled.slice(0, count);
126+
});
127+
128+
// Convert an associative array into an indexable, iterable array
129+
eleventyConfig.addFilter('iterable', (obj) => {
130+
var iterableArray = new Array();
131+
for (var item in obj) {
132+
iterableArray.push(obj[item]);
133+
}
134+
return iterableArray;
135+
});
136+
137+
// format a url for display
138+
eleventyConfig.addFilter('domain', (str) => {
139+
var url = new URL(str);
140+
return url.hostname;
141+
});
142+
143+
144+
// convert json to yaml
145+
eleventyConfig.addFilter('dumpasyaml', obj => {
146+
return yaml.safeDump(obj)
147+
});
148+
149+
// sort an array of objects by one object key value
150+
// can also get fancy and do a lodash.get selector string too
151+
// see https://lodash.com/docs/4.17.15#get
152+
eleventyConfig.addFilter('sortKey', (arr, selector) => {
153+
return arr.sort((a, b) => {
154+
let aKey = lodashGet(a, selector).toLowerCase();
155+
let bKey = lodashGet(b, selector).toLowerCase();
156+
if (aKey < bKey) {
157+
return -1;
158+
} else if (aKey > bKey) {
159+
return 1;
160+
}
161+
return 0;
162+
});
163+
});
164+
165+
eleventyConfig.addFilter('sortTools', (arr, githubData) => {
166+
return arr.sort((a, b) => {
167+
let aKey = githubData[a.data.repo] ? (githubData[a.data.repo].stars || 0) : 0;
168+
let bKey = githubData[b.data.repo] ? (githubData[b.data.repo].stars || 0) : 0;
169+
if (aKey < bKey) {
170+
return 1;
171+
} else if (aKey > bKey) {
172+
return -1;
173+
}
174+
return 0;
175+
});
176+
});
177+
178+
179+
// Format a path to avoid any Cloudinary URL API miss-steps.
180+
eleventyConfig.addFilter("cloudinaryifyPath", (str) => {
181+
182+
if (str) {
183+
184+
// add generic url encoding
185+
str = encodeURI(str);
186+
187+
// we also need to double escape some characters which might appear in text
188+
// but are meaningful in cloudinary URLs
189+
str = str.replace(/,/g, '%252C');
190+
str = str.replace(/\//g, '%252F');
191+
192+
}
193+
return str;
194+
});
195+
196+
197+
198+
// favicons files
199+
eleventyConfig.addPassthroughCopy("src/site/browserconfig.xml");
200+
eleventyConfig.addPassthroughCopy("src/site/site.webmanifest");
201+
eleventyConfig.addPassthroughCopy("src/site/survey/2021/community-survey-2021-methodology.pdf");
202+
203+
return {
204+
dir: {
205+
input: "src/site",
206+
inludes: "_includes",
207+
output: "dist"
208+
},
209+
passthroughFileCopy: true,
210+
markdownTemplateEngine: false,
211+
htmlTemplateEngine: "njk"
212+
};
213+
214+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const algoliaConfig = require("../../../algolia.config.js");
2+
3+
// don’t hardcode anything here, make the config variables opt-in
4+
module.exports = {
5+
appId: algoliaConfig.appId,
6+
indexName: algoliaConfig.indexName,
7+
searchOnlyApiKey: algoliaConfig.searchOnlyApiKey,
8+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"text": "Do you build websites and apps?",
3+
"cta": "Take the Jamstack Community Survey 2022 today!",
4+
"url": "https://netlify.qualtrics.com/jfe/form/SV_0BRbhN47gyZWYNo?Source=jamstack_eyebrow"
5+
}

0 commit comments

Comments
 (0)