From bd380760414cfdcf0a2568766adb33816b872ee7 Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Sun, 15 Oct 2017 17:31:16 +0100 Subject: [PATCH 1/2] Added share buttons --- src/css/main.scss | 22 ++++++++++++++++++++++ templates/partials/share.html | 6 ++++++ templates/post.html | 19 ++++++++++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 templates/partials/share.html diff --git a/src/css/main.scss b/src/css/main.scss index 83ff8e2..39aab3b 100644 --- a/src/css/main.scss +++ b/src/css/main.scss @@ -159,3 +159,25 @@ footer { height: 40px; } } + + +.share { + background: transparent; + border: none; + display: none; + cursor: pointer; + + &.show { + display: initial; + } + + &:hover, &:active { + fill: $link-color; + color: $link-color; + } + + svg { + height: 20px; + vertical-align: bottom; + } +} diff --git a/templates/partials/share.html b/templates/partials/share.html new file mode 100644 index 0000000..b2b8292 --- /dev/null +++ b/templates/partials/share.html @@ -0,0 +1,6 @@ + diff --git a/templates/post.html b/templates/post.html index 2974061..4fd4d0a 100644 --- a/templates/post.html +++ b/templates/post.html @@ -9,7 +9,7 @@

- {{ title }} + {{ title }} {{> share }}

@@ -25,6 +25,9 @@
+
+ {{> share shareText='Share this post'}} +
{{> footer }} @@ -52,5 +55,19 @@ } + From 62d3f0ab14e563b6cdaf4c2e36a3b1833d31b735 Mon Sep 17 00:00:00 2001 From: Marcus Noble Date: Sun, 15 Oct 2017 17:36:59 +0100 Subject: [PATCH 2/2] Improved title of pages --- app.js | 6 ++++++ templates/partials/head.html | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 6988805..7b0c6d0 100644 --- a/app.js +++ b/app.js @@ -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) diff --git a/templates/partials/head.html b/templates/partials/head.html index d5dd127..4cff1c9 100644 --- a/templates/partials/head.html +++ b/templates/partials/head.html @@ -3,7 +3,7 @@ - {{ site.title }} + {{ buildTitle title site.title }}