hexo 的 butterfly 主题添加 Google Adsense 后审核失败 | 独特的留白

已在 hexo 的 butterfly 主题配置文件中添加 google adsense 的客户号,但是 adsense 审核提示失败,如何解决?

已在 hexo 的 butterfly 主题配置文件中添加 google adsense 的客户号,但是 adsense 审核提示失败,如何解决?

Google Adsense 审核失败通知

hexo 的配置:

1
2
3
4
5
6
google_adsense:
enable: true
auto_ads: true
js: https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
client: ca-pub-1711515749423877
enable_page_level_ads: true

通过查看页面元素发现,静态页面中已经生成了 adsense 的代码:

1
2
3
4
<script async="async" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><script>(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: 'ca-pub-1711515749423877',
enable_page_level_ads: 'true'
});</script><

对比发现,这段 js 和接入 google adsense 的 code 不一致:

1
2
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1711515749423877"
crossorigin="anonymous"></script>

关掉 hexo 的中 google_adsense 的配置,不让 butterfly 生成代码:

1
2
3
4
5
6
google_adsense:
enable: false
auto_ads: true
js: https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
client: ca-pub-1711515749423877
enable_page_level_ads: true

在配置文件中搜索inject,做如下配置:

1
2
3
inject:
head:
- <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1711515749423877" crossorigin="anonymous"></script>

注意:以上所说的 hexo 配置指的是 butterfly 主题的配置文件。
另外:记得把 google clientId 更换为你自己的 Google Adsense clientId。