From 4a634f08da14826ed9b0bbea26278977387a6c5e Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Tue, 16 May 2017 13:05:21 +0800 Subject: [PATCH] Updated google analytics to index.hbs and hbs_renderer.rs --- src/renderer/html_handlebars/hbs_renderer.rs | 3 +++ src/theme/index.hbs | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 4fac6869..1d84c73d 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -193,6 +193,9 @@ fn make_data(book: &MDBook) -> Result data.insert("livereload".to_owned(), json!(livereload)); } + // Add google analytics tag + data.insert("google_analytics".to_owned(), json!("INSERT_GA_ID_HERE")); + let mut chapters = vec![]; for item in book.iter() { diff --git a/src/theme/index.hbs b/src/theme/index.hbs index a99752da..b3985fbc 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -111,6 +111,19 @@ {{{livereload}}} + {{#if google_analytics}} + + {{/if}} + +