From a2d3c7aa1e284f141e14481523f3488a65ccdbd7 Mon Sep 17 00:00:00 2001 From: amzrk2 Date: Fri, 17 Apr 2020 10:31:06 +0800 Subject: Use site variable to set GA --- exampleSite/config.toml | 6 +++--- layouts/partials/analytic-google.html | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 6b7e189..8a39090 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -13,6 +13,9 @@ languageCode = "en" summaryLength = 100 # Custom cummary length, add in post file to custom split point paginate = 10 +# Set your Google Analytics UA here, or comment out to disable +# googleAnalytics = "UA-000000000-0" + [permalinks] post = "/:filename/" # Custom post links, e.g. "/:year/:month/:title/" @@ -28,9 +31,6 @@ paginate = 10 # Posts shown in homepage mainSections = ["post"] - # Google Analytics - googleAnalyticsUA = "UA-000000000-0" - # Bangumi image chart id # bgmImageChart = "000000" diff --git a/layouts/partials/analytic-google.html b/layouts/partials/analytic-google.html index 2b5e74b..aa9915b 100644 --- a/layouts/partials/analytic-google.html +++ b/layouts/partials/analytic-google.html @@ -1,5 +1,6 @@ +{{ with .Site.GoogleAnalytics }} - + \ No newline at end of file + gtag('config', '{{ . }}'); + +{{ end }} \ No newline at end of file -- cgit v1.2.3