move ese year and color to global data file
This commit is contained in:
parent
324806b52f
commit
a4b69fac29
|
@ -2,7 +2,7 @@
|
||||||
<div id="header-veil"></div>
|
<div id="header-veil"></div>
|
||||||
<div class="header-container content">
|
<div class="header-container content">
|
||||||
<a id="header-logo" href="{{ "/" | locale_url }}" title="home">
|
<a id="header-logo" href="{{ "/" | locale_url }}" title="home">
|
||||||
<img alt="ESE {{year}} Logo" src="/ESELogo.svg">
|
<img alt="ESE {{ese.year}} Logo" src="/ESELogo.svg">
|
||||||
</a>
|
</a>
|
||||||
<nav id="mainNav">
|
<nav id="mainNav">
|
||||||
<button id="menu-toggle" onclick="toggleMenu()" aria-expanded="false"
|
<button id="menu-toggle" onclick="toggleMenu()" aria-expanded="false"
|
||||||
|
|
|
@ -89,7 +89,7 @@ p {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
--page-width: 1280px;
|
--page-width: 1280px;
|
||||||
--color-text: #495057;
|
--color-text: #495057;
|
||||||
--color-primary: {{ eseColor }};
|
--color-primary: {{ ese.color }};
|
||||||
--color-livestream-active: #fff;
|
--color-livestream-active: #fff;
|
||||||
--color-background-page: #fefefe;
|
--color-background-page: #fefefe;
|
||||||
--color-background-header: rgba(255,255,255,.92);
|
--color-background-header: rgba(255,255,255,.92);
|
||||||
|
|
|
@ -8,7 +8,7 @@ eleventyComputed:
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>{% if title %}{{ title }} | {% endif %}ESE {{ year }}</title>
|
<title>{% if title %}{{ title }} | {% endif %}ESE {{ ese.year }}</title>
|
||||||
<link rel="stylesheet" href="{% getBundleFileUrl "css" %}">
|
<link rel="stylesheet" href="{% getBundleFileUrl "css" %}">
|
||||||
<link rel="stylesheet" href="/aileron.lite.min.css">
|
<link rel="stylesheet" href="/aileron.lite.min.css">
|
||||||
<script>
|
<script>
|
||||||
|
|
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 yaml = require("js-yaml");
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
// update this :)
|
|
||||||
const year = 2024;
|
|
||||||
const eseColor = "#F221B7";
|
|
||||||
|
|
||||||
module.exports = function(eleventyConfig) {
|
module.exports = function(eleventyConfig) {
|
||||||
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
|
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
|
||||||
eleventyConfig.addPlugin(eleventyNavigationPlugin);
|
eleventyConfig.addPlugin(eleventyNavigationPlugin);
|
||||||
|
@ -33,9 +29,9 @@ module.exports = function(eleventyConfig) {
|
||||||
compile: async (inputContent) => {
|
compile: async (inputContent) => {
|
||||||
return async (data) => {
|
return async (data) => {
|
||||||
// insert year
|
// 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
|
// insert color
|
||||||
svg = svg.replaceAll("{{eseColor}}", data.eseColor);
|
svg = svg.replaceAll("{{eseColor}}", data.ese.color);
|
||||||
|
|
||||||
// render text to path
|
// render text to path
|
||||||
// TODO replace with ESM import once we switch to Eleventy v3
|
// 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.addDataExtension("yaml, yml", yaml.load);
|
||||||
|
|
||||||
eleventyConfig.addGlobalData("year", year);
|
|
||||||
eleventyConfig.addGlobalData("eseColor", eseColor);
|
|
||||||
|
|
||||||
eleventyConfig.addFilter("pageLang", function(value) {
|
eleventyConfig.addFilter("pageLang", function(value) {
|
||||||
return value.filter(item => item.page.lang === this.page.lang)
|
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 {
|
return {
|
||||||
dir: {
|
dir: {
|
||||||
input: "content",
|
input: "content",
|
||||||
includes: "../_includes",
|
includes: "../_includes",
|
||||||
},
|
},
|
||||||
pathPrefix: `/${year}/`,
|
pathPrefix: `/${eseData.year}/`,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue