added handlebars helper for common header tags

This commit is contained in:
bill bittner 2017-12-07 12:36:18 -08:00
parent 7791b4f685
commit 738a517738
5 changed files with 12 additions and 32 deletions

View file

@ -2,6 +2,10 @@ const Handlebars = require('handlebars');
const config = require('../config/speechConfig.js'); const config = require('../config/speechConfig.js');
module.exports = { module.exports = {
placeCommonHeaderTags () {
const headerBoilerplate = `<meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>Spee.ch</title><link rel="stylesheet" href="/assets/css/reset.css" type="text/css"><link rel="stylesheet" href="/assets/css/general.css" type="text/css"><link rel="stylesheet" href="/assets/css/mediaQueries.css" type="text/css">`;
return new Handlebars.SafeString(headerBoilerplate);
},
googleAnalytics () { googleAnalytics () {
const googleApiKey = config.analytics.googleId; const googleApiKey = config.analytics.googleId;
const gaCode = `<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ const gaCode = `<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View file

@ -1,13 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#"> <html lang="en" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
<head> <head>
<meta charset="UTF-8"> {{ placeCommonHeaderTags }}
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Spee.ch</title>
<link rel="stylesheet" href="/assets/css/reset.css" type="text/css">
<link rel="stylesheet" href="/assets/css/general.css" type="text/css">
<link rel="stylesheet" href="/assets/css/mediaQueries.css" type="text/css">
<meta name="twitter:card" content="summary" /> <meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@spee_ch" /> <meta name="twitter:site" content="@spee_ch" />
<meta property="og:title" content="{{this.channelName}} on Spee.ch"> <meta property="og:title" content="{{this.channelName}} on Spee.ch">

View file

@ -1,13 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#"> <html lang="en" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
<head> <head>
<meta charset="UTF-8"> {{ placeCommonHeaderTags }}
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Spee.ch</title>
<link rel="stylesheet" href="/assets/css/reset.css" type="text/css">
<link rel="stylesheet" href="/assets/css/general.css" type="text/css">
<link rel="stylesheet" href="/assets/css/mediaQueries.css" type="text/css">
<meta name="twitter:card" content="summary" /> <meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@spee_ch" /> <meta name="twitter:site" content="@spee_ch" />
<meta property="og:title" content="Spee.ch"> <meta property="og:title" content="Spee.ch">

View file

@ -1,13 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#"> <html lang="en" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#">
<head> <head>
<meta charset="UTF-8"> {{ placeCommonHeaderTags }}
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Spee.ch</title>
<link rel="stylesheet" href="/assets/css/reset.css" type="text/css">
<link rel="stylesheet" href="/assets/css/general.css" type="text/css">
<link rel="stylesheet" href="/assets/css/mediaQueries.css" type="text/css">
<meta property="fb:app_id" content="1371961932852223"> <meta property="fb:app_id" content="1371961932852223">
{{#unless claimInfo.nsfw}} {{#unless claimInfo.nsfw}}
{{{addTwitterCard claimInfo }}} {{{addTwitterCard claimInfo }}}

View file

@ -1,17 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#"> <html lang="en" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#">
<head> <head>
<meta charset="UTF-8"> {{ placeCommonHeaderTags }}
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Spee.ch</title>
<link rel="stylesheet" href="/assets/css/reset.css" type="text/css">
<link rel="stylesheet" href="/assets/css/general.css" type="text/css">
<link rel="stylesheet" href="/assets/css/mediaQueries.css" type="text/css">
<meta property="fb:app_id" content="1371961932852223"> <meta property="fb:app_id" content="1371961932852223">
{{#unless claimInfo.nsfw}} {{#unless claimInfo.nsfw}}
{{{addTwitterCard claimInfo.contentType openGraphInfo.source openGraphInfo.embedUrl openGraphInfo.directFileUrl}}} {{{addTwitterCard claimInfo }}}
{{{addOpenGraph claimInfo.title claimInfo.contentType openGraphInfo.showUrl openGraphInfo.source claimInfo.description claimInfo.thumbnail}}} {{{addOpenGraph claimInfo }}}
{{/unless}} {{/unless}}
<!-- google analytics --> <!-- google analytics -->
{{ googleAnalytics }} {{ googleAnalytics }}