Improved title of pages

This commit is contained in:
Marcus Noble 2017-10-15 17:36:59 +01:00
parent bd38076041
commit 62d3f0ab14
2 changed files with 7 additions and 1 deletions

6
app.js
View File

@ -39,6 +39,12 @@ Handlebars.registerHelper('moment', function(date, format) {
Handlebars.registerHelper("striptags", function(text){
return striptags(text);
});
Handlebars.registerHelper("buildTitle", function(title, siteTitle){
if (title.indexOf(siteTitle) < 0) {
title = `'${title}' by ${siteTitle}`;
}
return title;
});
Metalsmith(__dirname)

View File

@ -3,7 +3,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ site.title }}</title>
<title>{{ buildTitle title site.title }}</title>
<meta property="og:url" content="{{ site.url}}/{{ path }}"/>
<meta property="og:title" content="{{ title }}"/>