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

refactor: Modify google adsense

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