From 8b74ed680dd2352337d6b85df99a5996704f2604 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 21 Dec 2017 12:01:05 -0800 Subject: [PATCH] added truncate feature to description function --- helpers/handlebarsHelpers.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helpers/handlebarsHelpers.js b/helpers/handlebarsHelpers.js index 1d2c973e..d660a600 100644 --- a/helpers/handlebarsHelpers.js +++ b/helpers/handlebarsHelpers.js @@ -6,7 +6,12 @@ function determineOgTitle (storedTitle, defaultTitle) { }; function determineOgDescription (storedDescription, defaultDescription) { - return ifEmptyReturnOther(storedDescription, defaultDescription); + const length = 200; + let description = ifEmptyReturnOther(storedDescription, defaultDescription); + if (description.length >= length) { + description = `${description.substring(0, length)}...`; + }; + return description; }; function ifEmptyReturnOther (value, replacement) {