提交 93db468e 编写于 作者: EvanOne(文一)'s avatar EvanOne(文一)

refactor: Modify google adsense

上级 9b45c090
...@@ -765,9 +765,8 @@ pjax: ...@@ -765,9 +765,8 @@ pjax:
# Google AdSense # Google AdSense
google_adsense: google_adsense:
enable: false enable: false
js_src: https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
client: client:
enable_page_level_ads: true js_src: https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
# The links with `target="_blank"` attribute. # The links with `target="_blank"` attribute.
external_link: external_link:
......
...@@ -885,11 +885,10 @@ Stun 主题默认提供了一些 MathJax 和 Katex 的插件。 ...@@ -885,11 +885,10 @@ Stun 主题默认提供了一些 MathJax 和 Katex 的插件。
google_adsense: google_adsense:
# 是否启用 # 是否启用
enable: false enable: false
# 如果和你的代码中的地址不一样,请更换
js_src: https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
# 填写你的 client-id # 填写你的 client-id
client: client: ca-pub-xxxxxx
enable_page_level_ads: true # 如果和你的 AdSense 代码中的地址不一样,请更换
js_src: https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
``` ```
## 特效 ## 特效
......
...@@ -75,5 +75,4 @@ html(lang=config.language) ...@@ -75,5 +75,4 @@ html(lang=config.language)
include ./_third-party/analytics/busuanzi.pug include ./_third-party/analytics/busuanzi.pug
include ./_third-party/comments/index.pug include ./_third-party/comments/index.pug
include ./_third-party/advertising/index.pug
include ./_scripts/stun.pug include ./_scripts/stun.pug
...@@ -114,5 +114,6 @@ if theme.baidu_analytics ...@@ -114,5 +114,6 @@ if theme.baidu_analytics
if theme.tencent_analytics if theme.tencent_analytics
link(rel="dns-prefetch" href="https://tajs.qq.com") link(rel="dns-prefetch" href="https://tajs.qq.com")
include ../../_third-party/advertising/index.pug
include ../../_third-party/analytics/index.pug include ../../_third-party/analytics/index.pug
include ../config.pug include ../config.pug
script(src=theme.google_adsense.js_src async='')&attributes(dataPjax) script(
script&attributes(dataPjax). src=theme.google_adsense.js_src
(adsbygoogle = window.adsbygoogle || []).push({ data-ad-client=theme.google_adsense.client
google_ad_client: '!{ theme.google_adsense.client }', async=""
enable_page_level_ads: !{ theme.google_adsense.enable_page_level_ads } )&attributes(dataPjax)
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册