first
This commit is contained in:
48
_config/filters.js
Normal file
48
_config/filters.js
Normal file
@ -0,0 +1,48 @@
|
||||
export default function(eleventyConfig) {
|
||||
// Return the keys used in an object
|
||||
eleventyConfig.addFilter("getKeys", target => {
|
||||
return Object.keys(target);
|
||||
});
|
||||
|
||||
/* */
|
||||
eleventyConfig.addFilter("getTagline", tag => {
|
||||
let tagline;
|
||||
switch (tag) {
|
||||
case "animals and the outdoors":
|
||||
tagline = "grass touchin'";
|
||||
break;
|
||||
case "art and crafts":
|
||||
/* tagline = */
|
||||
break;
|
||||
case "food and drink":
|
||||
tagline = "good eatin'";
|
||||
break;
|
||||
case "history and science":
|
||||
/* tagline = */
|
||||
break;
|
||||
case "home improvement and diy":
|
||||
tagline = "fixin' stuff";
|
||||
break;
|
||||
case "interpersonal and life":
|
||||
/* tagline = */
|
||||
break;
|
||||
case "technology":
|
||||
tagline = "computer touchin'";
|
||||
break;
|
||||
case "writing, editing, and literature":
|
||||
/* tagline = */
|
||||
break;
|
||||
};
|
||||
return tagline;
|
||||
});
|
||||
|
||||
/* Filter out structural tags */
|
||||
eleventyConfig.addFilter("removeCoreTags", (tags) => {
|
||||
return tags.filter(tag => ["all"].indexOf(tag) === -1);
|
||||
});
|
||||
|
||||
/* What it says on the tin */
|
||||
eleventyConfig.addFilter("sortAlphabetically", strings =>
|
||||
(strings || []).sort((b, a) => b.localeCompare(a))
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user