move ese year and color to global data file
This commit is contained in:
parent
324806b52f
commit
f5a22b777b
|
@ -89,7 +89,7 @@ p {
|
|||
font-size: 12px;
|
||||
--page-width: 1280px;
|
||||
--color-text: #495057;
|
||||
--color-primary: {{ eseColor }};
|
||||
--color-primary: {{ ese.color }};
|
||||
--color-livestream-active: #fff;
|
||||
--color-background-page: #fefefe;
|
||||
--color-background-header: rgba(255,255,255,.92);
|
||||
|
|
2
content/_data/ese.yaml
Normal file
2
content/_data/ese.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
year: 2024
|
||||
color: "#F221B7"
|
|
@ -5,10 +5,6 @@ const pluginIcons = require('eleventy-plugin-icons');
|
|||
const yaml = require("js-yaml");
|
||||
const fs = require('fs');
|
||||
|
||||
// update this :)
|
||||
const year = 2024;
|
||||
const eseColor = "#F221B7";
|
||||
|
||||
module.exports = function(eleventyConfig) {
|
||||
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
|
||||
eleventyConfig.addPlugin(eleventyNavigationPlugin);
|
||||
|
@ -33,9 +29,9 @@ module.exports = function(eleventyConfig) {
|
|||
compile: async (inputContent) => {
|
||||
return async (data) => {
|
||||
// insert year
|
||||
let svg = inputContent.replace("{{year}}", String(data.year).slice(-2));
|
||||
let svg = inputContent.replace("{{year}}", String(data.ese.year).slice(-2));
|
||||
// insert color
|
||||
svg = svg.replaceAll("{{eseColor}}", data.eseColor);
|
||||
svg = svg.replaceAll("{{eseColor}}", data.ese.color);
|
||||
|
||||
// render text to path
|
||||
// TODO replace with ESM import once we switch to Eleventy v3
|
||||
|
@ -57,9 +53,6 @@ module.exports = function(eleventyConfig) {
|
|||
|
||||
eleventyConfig.addDataExtension("yaml, yml", yaml.load);
|
||||
|
||||
eleventyConfig.addGlobalData("year", year);
|
||||
eleventyConfig.addGlobalData("eseColor", eseColor);
|
||||
|
||||
eleventyConfig.addFilter("pageLang", function(value) {
|
||||
return value.filter(item => item.page.lang === this.page.lang)
|
||||
});
|
||||
|
@ -82,11 +75,13 @@ module.exports = function(eleventyConfig) {
|
|||
}
|
||||
);
|
||||
|
||||
const eseData = yaml.load(fs.readFileSync('./content/_data/ese.yaml'));
|
||||
|
||||
return {
|
||||
dir: {
|
||||
input: "content",
|
||||
includes: "../_includes",
|
||||
},
|
||||
pathPrefix: `/${year}/`,
|
||||
pathPrefix: `/${eseData.year}/`,
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue