From 3fbc251c9ce64e804db6c5d2a4e2fe50518fe065 Mon Sep 17 00:00:00 2001 From: Johan Preynat Date: Wed, 20 Apr 2016 14:59:18 +0200 Subject: [PATCH 1/2] Set hjid property as required --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 963992d..c8da454 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "hjid": { "type": "number", "title": "Hotjar Analytics ID", - "required": false + "required": true } } } From 97ab88d02861decdb5dd2edfb8eb862b12cc2580 Mon Sep 17 00:00:00 2001 From: Johan Preynat Date: Wed, 20 Apr 2016 14:59:50 +0200 Subject: [PATCH 2/2] Include Hotjar tracking code using GitBook 3 templating --- _layouts/website/page.html | 16 ++++++++++++++++ index.js | 22 +--------------------- 2 files changed, 17 insertions(+), 21 deletions(-) create mode 100644 _layouts/website/page.html diff --git a/_layouts/website/page.html b/_layouts/website/page.html new file mode 100644 index 0000000..c4a8913 --- /dev/null +++ b/_layouts/website/page.html @@ -0,0 +1,16 @@ +{% extends template.self %} + +{% block javascript %} + {{ super() }} + " + +{% endblock %} \ No newline at end of file diff --git a/index.js b/index.js index 62bbe19..61eb482 100644 --- a/index.js +++ b/index.js @@ -3,26 +3,6 @@ module.exports = { assets: "./book", js: [ "plugin.js" - ], - html: { - "body:end": function() { - var config = this.options.pluginsConfig.hotjar || {}; - - if (!config.hjid) { - throw "Hotjar: option 'hjid' is required."; - } - - return "" - + "" - + ""; - } - } + ] } };