diff --git a/helpers.js b/helpers.js index 4044d54..0d3abe6 100644 --- a/helpers.js +++ b/helpers.js @@ -14,3 +14,10 @@ function removeIvalidDataURL (content) { let regex = /data:\S+;base64\S*/gm return content.replace(regex, '#') } + +exports.formatMetaTitle = (title) => { + if (!title) { + return 'The Example App' + } + return `${title.charAt(0).toUpperCase()}${title.slice(1)} — The Example App` +} diff --git a/public b/public index 2d5cc47..0570817 160000 --- a/public +++ b/public @@ -1 +1 @@ -Subproject commit 2d5cc47ae49e0468532839bae8eaf4e087b97722 +Subproject commit 057081793633dc32f8fc782ee174fafab78c2e52 diff --git a/views/layout.pug b/views/layout.pug index 878355e..9ba6bde 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -1,15 +1,18 @@ doctype html html head - title= title + title= helpers.formatMetaTitle(title) link(rel='stylesheet', href='/stylesheets/style.css') meta(name='viewport' content='width=device-width, initial-scale=1') meta(name='description' content='This is The Example App, an application built to serve you as a reference while building your own applications using Contentful.') meta(name='twitter:card' value='This is The Example App, an application built to serve you as a reference while building your own applications using Contentful.') - meta(property='og:title' content=title) + meta(property='og:title' content=helpers.formatMetaTitle(title)) meta(property='og:type' content='article') meta(property='og:url' content='http://contentful-example-app.herokuapp.com/') - meta(property='og:image' content='http://contentful-example-app.herokuapp.com/images/logo.svg') + meta(property='og:image' content='http://contentful-example-app.herokuapp.com/og-image.jpg') + meta(property='og:image:type' content='image/jpeg') + meta(property='og:image:width' content='1200') + meta(property='og:image:height' content='1200') meta(property='og:description' content='This is The Example App, an application built to serve you as a reference while building your own applications using Contentful.') link(rel='apple-touch-icon' sizes='120x120' href='/apple-touch-icon.png') link(rel='icon' type='image/png' sizes='32x32' href='/favicon-32x32.png')