improved the changelog & in-game news display on the docs site

This commit is contained in:
Ell 2023-04-08 14:45:45 +02:00
parent 93225b48a0
commit e34488f498
2 changed files with 17 additions and 1 deletions

View file

@ -41,7 +41,8 @@
"dest": "_site", "dest": "_site",
"template": [ "template": [
"default", "default",
"modern" "modern",
"overrides"
] ]
} }
} }

View file

@ -0,0 +1,15 @@
exports.preTransform = function (model) {
if (model._path.includes("Changelog") || model._path.includes("InGameNews")) {
// reduce header levels by 1
model.conceptual = model.rawTitle + model.conceptual;
for (let i = 5; i >= 1; i--) {
model.conceptual = model.conceptual.replaceAll(`<h${i}`, `<h${i + 1}`);
model.conceptual = model.conceptual.replaceAll(`</h${i}`, `</h${i + 1}`);
}
// set appropriate title
model.title = model._path.includes("Changelog") ? "Changelog" : "In-Game News";
model.rawTitle = `<h1>${model.title}</h1>`;
}
return model;
};