Added google_analytics so it can be inserted into handlebars
This commit is contained in:
parent
ada1f29b34
commit
94dce4f796
|
@ -36,6 +36,8 @@ pub struct MDBook {
|
||||||
/// Should `mdbook build` create files referenced from SUMMARY.md if they
|
/// Should `mdbook build` create files referenced from SUMMARY.md if they
|
||||||
/// don't exist
|
/// don't exist
|
||||||
pub create_missing: bool,
|
pub create_missing: bool,
|
||||||
|
|
||||||
|
pub google_analytics: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MDBook {
|
impl MDBook {
|
||||||
|
@ -84,6 +86,7 @@ impl MDBook {
|
||||||
|
|
||||||
livereload: None,
|
livereload: None,
|
||||||
create_missing: true,
|
create_missing: true,
|
||||||
|
google_analytics: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,9 @@ fn make_data(book: &MDBook) -> Result<serde_json::Map<String, serde_json::Value>
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add google analytics tag
|
// Add google analytics tag
|
||||||
data.insert("google_analytics".to_owned(), json!("INSERT_GA_ID_HERE"));
|
if let Some(ref ga) = book.google_analytics {
|
||||||
|
data.insert("google_analytics".to_owned(), json!(ga));
|
||||||
|
}
|
||||||
|
|
||||||
let mut chapters = vec![];
|
let mut chapters = vec![];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue