Skip to content

如何在本機測試草稿時取消加入 GA 追蹤碼? #888

Closed Answered by CaiJimmy
wastu01 asked this question in Q&A
Discussion options

You must be logged in to vote

https://github.com/CaiJimmy/hugo-theme-stack/blob/bdb9e7fc007a665fadb28055bee6e387cd68719b/layouts/partials/head/head.html#L25C15-L25C46

Stack 直接使用了 Hugo 自带的 GA 模板:_internal/google_analytics.html,具体的实现在这里:https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/google_analytics.html

我看了一下,没有判断是不是在本地访问。所以需要自己复制一份 _internal/google_analytics.html 然后加入这一逻辑。主题暂时没有实现此功能。

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by wastu01
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants