没有不值得去解决的问题,也没有不值得去学习的技术!

在 WordPress 6 的 AMP 网站上设置 Google AdSense 自动广告

点击应用,打开:https://www.shuijingwanwq.com/amp/ ,Google AdSense 自动广告已经成功显示

1、参考:https://www.shuijingwanwq.com/2023/03/16/7483/ 。AMP 网站基于插件:Accelerated Mobile Pages

2、打开:https://www.shuijingwanwq.com/amp/ ,网页上暂未设置 Google AdSense 自动广告。参考:https://support.google.com/adsense/answer/9261309 。在您的 AMP 网站上设置自动广告

3、使用 <link> 标记将非 AMP 内容与 AMP 内容配对,从而使您的网页可被轻松发现 。此项准备工作已经被插件实现。在非 AMP 网页 https://www.shuijingwanwq.com 的 <head> 中添加 <link> 标记:<link rel=”amphtml” href=”https://www.shuijingwanwq.com/amp/” /> 。如图1

使用 <link> 标记将非 AMP 内容与 AMP 内容配对,从而使您的网页可被轻松发现 。此项准备工作已经被插件实现。在非 AMP 网页 https://www.shuijingwanwq.com 的 <head> 中添加 <link> 标记:<link rel="amphtml" href="https://www.shuijingwanwq.com/amp/" />
图1

4、此项准备工作已经被插件实现。在 AMP 网页 https://www.shuijingwanwq.com/amp/ 的 <head> 中添加 <link> 标记:<link rel=”canonical” href=”https://www.shuijingwanwq.com/”> 。如图2

此项准备工作已经被插件实现。在 AMP 网页 https://www.shuijingwanwq.com/amp/ 的 <head> 中添加 <link> 标记:<link rel="canonical" href="https://www.shuijingwanwq.com/">
图2

5、在“AMP 自动广告”页面上,开启 AMP 自动广告。如图3

在“AMP 自动广告”页面上,开启 AMP 自动广告
图3

6、在 WordPress 6 后台的 AMP – Settings – Advertisement ,关闭 Ad Revenue Optimization。如图4

在 WordPress 6 后台的 AMP - Settings - Advertisement ,关闭 Ad Revenue Optimization
图4

7、点击获取 AMP 代码,将此代码放置在 AMP 版本的网站上。在 WordPress 6 后台的 AMP – Settings – Advance Settings,分别在 Enter HTML in Head 与 Enter HTML in Body (beginning of body tag) 中粘贴代码。如图5

点击获取 AMP 代码,将此代码放置在 AMP 版本的网站上。在 WordPress 6 后台的 AMP - Settings - Advance Settings,分别在 Enter HTML in Head 与 Enter HTML in Body (beginning of body tag) 中粘贴代码
图5

8、查看 https://www.shuijingwanwq.com/amp/ 的源代码,确认代码已经添加成功。如图6

查看 https://www.shuijingwanwq.com/amp/ 的源代码,确认代码已经添加成功
图6

9、点击应用,打开:https://www.shuijingwanwq.com/amp/ ,Google AdSense 自动广告已经成功显示。如图7

点击应用,打开:https://www.shuijingwanwq.com/amp/ ,Google AdSense 自动广告已经成功显示
图7

10、建议设置移动重定向,当在移动设备中打开 https://www.shuijingwanwq.com/ 时,自动重定向至 https://www.shuijingwanwq.com/amp/ 。在 WordPress 6 后台的 AMP – Settings – Advance Settings – Mobile Redirection。如图8

建议设置移动重定向,当在移动设备中打开 https://www.shuijingwanwq.com/ 时,自动重定向至 https://www.shuijingwanwq.com/amp/ 。在 WordPress 6 后台的 AMP - Settings - Advance Settings - Mobile Redirection
图8

需要长期技术维护或远程问题排查?

我是拥有 15+ 年经验的 PHP / Go 后端工程师,长期关注已有系统维护、Bug 修复、性能优化、服务器排查、WordPress 网站维护和小功能迭代。

如果你的项目遇到以下情况,可以先从一次小问题排查开始合作:

  • ✅ PHP / Laravel / Yii2 老项目无人维护
  • ✅ Go / Gin 后端接口需要排查或优化
  • ✅ WordPress 网站访问慢、报错或插件冲突
  • ✅ Nginx / MySQL / Redis / Linux 服务器异常
  • ✅ CDN / Cloudflare / DNS / HTTPS 配置问题
  • ✅ 需要长期远程技术支持或兼职维护

更多介绍请查看:关于我 & 合作

微信:13980074657
邮箱:shuijingwanwq@gmail.com
Telegram:@shuijingwan
GitHub:https://github.com/shuijingwan

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理