fix(sharing): give context to title and use proper og:image

This commit is contained in:
Benedikt Rötsch
2017-10-25 13:24:39 +02:00
committed by Benedikt Rötsch
parent 5ddccf27d2
commit 490ec80f89
3 changed files with 14 additions and 4 deletions

View File

@@ -14,3 +14,10 @@ function removeIvalidDataURL (content) {
let regex = /data:\S+;base64\S*/gm let regex = /data:\S+;base64\S*/gm
return content.replace(regex, '#') return content.replace(regex, '#')
} }
exports.formatMetaTitle = (title) => {
if (!title) {
return 'The Example App'
}
return `${title.charAt(0).toUpperCase()}${title.slice(1)} — The Example App`
}

2
public

Submodule public updated: 2d5cc47ae4...0570817936

View File

@@ -1,15 +1,18 @@
doctype html doctype html
html html
head head
title= title title= helpers.formatMetaTitle(title)
link(rel='stylesheet', href='/stylesheets/style.css') link(rel='stylesheet', href='/stylesheets/style.css')
meta(name='viewport' content='width=device-width, initial-scale=1') 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='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(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:type' content='article')
meta(property='og:url' content='http://contentful-example-app.herokuapp.com/') 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.') 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='apple-touch-icon' sizes='120x120' href='/apple-touch-icon.png')
link(rel='icon' type='image/png' sizes='32x32' href='/favicon-32x32.png') link(rel='icon' type='image/png' sizes='32x32' href='/favicon-32x32.png')