Add page title filter

I want the home page to use just `title` as the page title, but I want
other pages to add the site name to the page title. This filter does
that and spits out the final title.
This commit is contained in:
Devon Campbell 2023-07-30 10:02:51 -05:00
commit e901a8360f
2 changed files with 27 additions and 18 deletions

View file

@ -20,6 +20,13 @@ module.exports = function(eleventyConfig) {
"node_modules/simpledotcss/simple.css": "css/simple.css",
});
eleventyConfig.addFilter("buildPageTitle", function(title) {
if (this.page.url === '/') {
return title;
} else {
return title + ' ⇢ Devon.LoL 😆';
}
});
eleventyConfig.addFilter("stringToDate", function(value) {
return new Date(value);
});