AMP/MIP插件For Typecho

提示:本文更新于 2342 天前,技术内容可能已发生变化,仅供参考。

之前心血来潮暴力实现了AMP页面,本来只是自己瞎折腾一下。结果发现还是有不少TX有这个需求,于是利用今天从福州回来车上的时间将AMP页面做成了插件,有需要的TX可以去Github上自取

由于是第一次做Typecho的插件,所以有什么问题请反馈,我好及时修复。

嗯,就这样,平潭的风真的好大……

amp-mip.jpg


哦,对了,如果之前已经用过模板暴力修改法的TX(尤其是已经被Google收录了的),请做如下修改:

post.php增加跳转


    <?php if (isset($_GET['amp'])){;
        header('HTTP/1.1 301 Moved Permanently');
        Header("Location: https://holmesian.org/amp/{$this->request->slug}");
        exit();
        ?>
    ...

header.php中删除下列内容

    <?php if ($this->is('post')): ?>
    <link rel="amphtml" href="<?php $this->permalink() ?>?amp=1">
    <?php endif; ?>

「倘若有所帮助,不妨酌情赞赏!」

Holmesian

感谢您的支持!

使用微信扫描二维码赞赏


相关文章

发表新评论
已有 346 条评论
  1. 陶小桃Blog

    最新报错:
    2023/01/10 03:13:46 [error] 21419#0: *728720 FastCGI sent in stderr: "PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/52txr.cn/usr/plugins/AMP/Action.php on line 388PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/52txr.cn/usr/plugins/AMP/Action.php on line 388" while reading response header from upstream, client: 172.70.174.116, server: 52txr.cn, request: "GET /mip/driverCrack.html HTTP/2.0", upstream: "fastcgi://unix:/tmp/php-cgi-74.sock:", host: "www.52txr.cn"

    陶小桃Blog 回复
  2. MBRjun

    大佬AMP插件还维护嘛?考虑增加个渲染Markdown表格?

    MBRjun 回复
  3. 世界和平


    typecho升级到1.2后提交的页面进去空白

    世界和平 回复
  4. 世界和平


    这里点进去空白

    世界和平 回复
  5. ding

    图片不得小于建议值的问题正面解决啊

    ding 回复
  6. ding

    图片不得小于建议值的问题正面解决啊

    ding 回复
  7. 叶子

    插件确实很不错,但是请问为什么用了https,AMP版首页依然无法正常使用
    如图:https://z3.ax1x.com/2021/04/28/gPGk5V.jpg 首页根本没有内容

    叶子 回复
  8. 叶子

    插件确实很不错,但是请问为什么用了https,AMP版首页依然无法正常使用
    如图:https://z3.ax1x.com/2021/04/28/gPGk5V.jpg 首页根本没有内容

    叶子 回复
  9. 叶子

    插件确实很不错,但是请问为什么用了https,AMP版首页依然无法正常使用
    如图:https://z3.ax1x.com/2021/04/28/gPGk5V.jpg 首页根本没有内容

    叶子 回复
  10. 叶子

    插件确实很不错,但是请问为什么用了https,AMP版首页依然无法正常使用
    如图:https://z3.ax1x.com/2021/04/28/gPGk5V.jpg 首页根本没有内容

    叶子 回复