Skip to content

Commit

Permalink
Setup new schema to add communities & guilds. Starting to build out c…
Browse files Browse the repository at this point in the history
…ommunity creation flow
  • Loading branch information
domitriusclark committed Dec 9, 2021
1 parent 8745384 commit c73c72e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
40 changes: 20 additions & 20 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const lodashGet = require("lodash/get");
const yaml = require("js-yaml");

module.exports = function(eleventyConfig) {
module.exports = function (eleventyConfig) {
// Support yaml data files
eleventyConfig.addDataExtension("yaml", contents => yaml.safeLoad(contents))

Expand All @@ -19,7 +19,7 @@ module.exports = function(eleventyConfig) {
const { DateTime } = require('luxon');
eleventyConfig.addFilter('formatDate', (dateObj, formatStr) => {
// convert any date strings to read dates
if(typeof(dateObj) == "string") {
if (typeof (dateObj) == "string") {
dateObj = new Date(dateObj);
}
const format = formatStr ? formatStr : 'LLLL d, y';
Expand All @@ -45,7 +45,7 @@ module.exports = function(eleventyConfig) {
});


eleventyConfig.addCollection("resources", function(collectionApi) {
eleventyConfig.addCollection("resources", function (collectionApi) {
return collectionApi.getFilteredByGlob("src/site/resources/*.md");
});

Expand All @@ -72,7 +72,7 @@ module.exports = function(eleventyConfig) {

// filter a data array based on the value of a property
eleventyConfig.addFilter('select', (array, clause) => {
if(clause.indexOf("=") > -1) {
if (clause.indexOf("=") > -1) {
const property = clause.split("=")[0];
const value = clause.split("=")[1];
return array.filter(item => lodashGet(item, property).includes(value));
Expand All @@ -83,9 +83,9 @@ module.exports = function(eleventyConfig) {

eleventyConfig.addFilter('flatten', (array) => {
let results = [];
for(let result of array) {
if(result) {
if(Array.isArray(result)) {
for (let result of array) {
if (result) {
if (Array.isArray(result)) {
results = [...results, ...result];
} else {
results.push(result);
Expand All @@ -97,8 +97,8 @@ module.exports = function(eleventyConfig) {

eleventyConfig.addFilter('unique', (array) => {
let caseInsensitive = {};
for(let val of array) {
if(typeof val === "string") {
for (let val of array) {
if (typeof val === "string") {
caseInsensitive[val.toLowerCase()] = val;
}
}
Expand All @@ -110,15 +110,15 @@ module.exports = function(eleventyConfig) {
if (count > array.length) {
count = array.length;
}
const shuffled = array.sort( () => 0.5 - Math.random() );
const shuffled = array.sort(() => 0.5 - Math.random());
return shuffled.slice(0, count);
});

// Convert an associative array into an indexable, iterable array
eleventyConfig.addFilter('iterable', (obj) => {
var iterableArray = new Array();
for (var item in obj){
iterableArray.push( obj[item] );
for (var item in obj) {
iterableArray.push(obj[item]);
}
return iterableArray;
});
Expand All @@ -142,9 +142,9 @@ module.exports = function(eleventyConfig) {
return arr.sort((a, b) => {
let aKey = lodashGet(a, selector).toLowerCase();
let bKey = lodashGet(b, selector).toLowerCase();
if(aKey < bKey) {
if (aKey < bKey) {
return -1;
} else if(aKey > bKey) {
} else if (aKey > bKey) {
return 1;
}
return 0;
Expand All @@ -155,9 +155,9 @@ module.exports = function(eleventyConfig) {
return arr.sort((a, b) => {
let aKey = githubData[a.data.repo] ? (githubData[a.data.repo].stars || 0) : 0;
let bKey = githubData[b.data.repo] ? (githubData[b.data.repo].stars || 0) : 0;
if(aKey < bKey) {
if (aKey < bKey) {
return 1;
} else if(aKey > bKey) {
} else if (aKey > bKey) {
return -1;
}
return 0;
Expand All @@ -168,11 +168,11 @@ module.exports = function(eleventyConfig) {
// Format a path to avoid any Cloudinary URL API miss-steps.
eleventyConfig.addFilter("cloudinaryifyPath", (str) => {

if(str) {
if (str) {

// add generic url encoding
str = encodeURI(str);

// we also need to double escape some characters which might appear in text
// but are meaningful in cloudinary URLs
str = str.replace(/,/g, '%252C');
Expand All @@ -189,7 +189,7 @@ module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("src/site/site.webmanifest");
eleventyConfig.addPassthroughCopy("src/site/survey/2021/community-survey-2021-methodology.pdf");

return {
return {
dir: {
input: "src/site",
inludes: "_includes",
Expand Down
2 changes: 1 addition & 1 deletion src/site/_includes/header.njk
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<div class="text-center text-sm mb-4 text-gray-300">Connect with us</div>
<div class="grid grid-cols-3 divide-x divide-gray-700 text-gray-300">
<a href="https://jamstack.org/slack" target="_BLANK" rel="noopener" class="flex items-center justify-center p-4 hover:text-pink-500">
<svg role="img" aria-label="Slack" focusable="false" width="30" height="30" class="fill-current"><use xlink:href="#logo-slack"></use></svg>
<svg role="img" aria-label="Discord" focusable="false" width="30" height="30" class="fill-current"><use xlink:href="#logo-discord"></use></svg>
</a>
<a href="https://twitter.com/jamstackconf" target="_BLANK" rel="noopener" class="flex items-center justify-center p-4 hover:text-pink-500">
<svg role="img" aria-label="Twitter" focusable="false" width="34" height="28" class="fill-current"><use xlink:href="#logo-twitter"></use></svg>
Expand Down

0 comments on commit c73c72e

Please sign in to comment.