diff --git a/CHANGELOG.md b/CHANGELOG.md index 894d15c5..1a5a1693 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ For detailed information check [Blogophon's releases on Github](https://github.c * :gift: Add [abc music notation](http://abcnotation.com/wiki/abc:standard:v2.1) syntax highlighter * :gift: Add [Exapunks' AXIOM](http://www.zachtronics.com/exapunks/) syntax highlighter * :gift: Add more information to `opensearch.xml` +* :gift: Add Handlebar helpers to export Google Tag Manager Datalayer +* :gift: Add Handlebar helpers for data dumping 1.5.0 ----- diff --git a/docs/development.md b/docs/development.md index fd266e20..001d3d63 100644 --- a/docs/development.md +++ b/docs/development.md @@ -75,9 +75,11 @@ Last but not least have a look at [`lib/helpers/blogophon-handlebars-quoters.js` {{#ifEquals tag 'new'}}It's new!{{/ifEquals}} - + {{#ifMatches tag '[Nn]ew'}}It's new!{{/ifMatches}} + + ``` ### Favicons diff --git a/lib/helpers/blogophon-handlebars-quoters.js b/lib/helpers/blogophon-handlebars-quoters.js index c11c0dd9..7b40ee03 100644 --- a/lib/helpers/blogophon-handlebars-quoters.js +++ b/lib/helpers/blogophon-handlebars-quoters.js @@ -100,6 +100,33 @@ const blogophonHandlebarsQuoters = { return superString(text).niceShorten(maxChars, replaceString); }, + /** + * [description] + * @param {Object} dumpData [description] + * @param {String} options [description] + * @return {String} [description] + */ + consoleDump: function(dumpData, options) { + let html = ''; + return html; + }, + + /** + * [description] + * @param {Object} dataLayer [description] + * @param {String} options) [description] + * @return {String} [description] + */ + dataLayer: function(dataLayer, options) { + let html = 'window.dataLayer = window.dataLayer || [];'; + html += 'window.dataLayer.push(' + options.fn(JSON.stringify(dataLayer)) + ');'; + return html; + }, + /** * @see https://stackoverflow.com/questions/34252817/handlebarsjs-check-if-a-string-is-equal-to-a-value * @param {String} haystack [description]