为您的网站提供AMP化改造,可自动生成符合AMP规范的模板。可选择安装组件支持门户文章页,论坛内容页和群组内容页等。
可选择组件安装:论坛贴子页组件 门户文章页组件
=================AMP网址方案=============================
方案一:
https://demo.onexin.com/amp/thread-461-1-1.html
https://demo.onexin.com/amp/article-11-1.html
方案二:
https://demo.onexin.com/amp-thread-461-1-1.html
https://demo.onexin.com/amp-article-11-1.html
方案三(未启用伪静态时):
https://demo.onexin.com/forum.php?mod=viewthread&tid=461&=1
https://demo.onexin.com/portal.php?mod=view&aid=11&=1
注:推荐固定使用其中一种方案。(伪静态跟随系统设置,不需要特殊修改。)
=================伪静态规则=================
# APACHE AMP
RewriteRule ^amp([^\.].*)?$ plugin.php?id=onexin_amp&rewrite=$1&%1
# Nginx Web Server
rewrite ^([^\.]*)/amp([^\.].*)?$ $1/plugin.php?id=onexin_amp&rewrite=$2 last;
=================更多AMP知识=================
如何优化移动页面,你需要了解AMP和PWA
https://mp.weixin.qq.com/s/pqC-iPFX6DzGTPTwqMhzLA
AMP富媒体搜索结果测试
https://search.google.com/test/rich-results
-
当前版本
主框架 5.2
-
2020-08-12 19:14
标准框架 4.6
-
2019-06-25 13:57
标准框架 4.1.2
更多历史版本信息
5.1
增加AMP 404显示页面
4.6
增加侧边导航菜单
增加相关阅读
优化部分代码
新增独立MIP开关
修复已知BUG
太赞了,安装就能使用,没有常见问题。
伪静态规则,放在默认规则的上方:
# APACHE AMP
RewriteRule ^amp([^\.].*)?$ plugin.php?id=onexin_amp&rewrite=$1&%1
# Nginx Web Server
rewrite ^([^\.]*)/amp([^\.].*)$ $1/plugin.php?id=onexin_amp&rewrite=$2 last;
# IIS 7.x及以上 Web Server(独立主机用户)
<rule name="onexin_amp">
<match url="^(.*/)*amp([^\.].*)?$" />
<action type="Rewrite" url="{R:1}/plugin.php\?id=onexin_amp&rewrite={R:2}" />
</rule>
头部加JS或CSS:
<style amp-custom>
/* Generic WP styling */
.alignright { float: right; }
.alignleft { float: left; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.amp-wp-enforced-sizes { max-width: 100%; margin: 0 auto; }
.amp-wp-unknown-size img { object-fit: contain; }
/* Template Styles */
.amp-wp-content, .amp-wp-title-bar div { margin: 0 auto; max-width: 525px; }
html { }
body { background: #fff; color: #353535; font-family: 'Times New Roman', Times, Serif; font-weight: 300; line-height: 1.75em; }
body { font-size: 1em; }
/**/
p, ol, ul, figure { margin: 0 0 1em; padding: 0; }
a, a:visited { color: #0a89c0; }
a:hover, a:active, a:focus { color: #353535; }
/* Quotes */
blockquote { color: #353535; background: rgba(127,127,127,.125); border-left: 2px solid #0a89c0; margin: 8px 0 24px 0; padding: 16px; }
blockquote p:last-child { margin-bottom: 0; }
/* UI Fonts */
.amp-wp-meta, .amp-wp-header div, .amp-wp-title, .wp-caption-text, .amp-wp-tax-category, .amp-wp-tax-tag, .amp-wp-comments-link, .amp-wp-footer p, .back-to-top { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif; }
/* Header */
.amp-wp-header { background-color: #0a89c0; }
.amp-wp-header div { color: #fff; font-weight: 400; margin: 0 auto; max-width: calc(100% - 32px); position: relative; padding-top: 4px; }
.amp-wp-header a { color: #fff; text-decoration: none; }
.amp-wp-header .amp-site-title { vertical-align: top; line-height: 34px; }
.amp-wp-header .amp-wp-site-icon { background-color: #fff; border: 1px solid #fff; border-radius: 50%; }
/* Article */
.amp-wp-article { color: #353535; font-weight: 400; margin: 1.5em auto; max-width: 100%; overflow-wrap: break-word; word-wrap: break-word; }
/* Article Header */
.amp-wp-article-header { align-items: center; align-content: stretch; display: flex; flex-wrap: wrap; justify-content: space-between; margin: 1.5em 16px 0; }
.amp-wp-title { color: #353535; display: block; flex: 1 0 100%; font-weight: 900; margin: 0 0 .625em; width: 100%; }
/* Article Meta */
.amp-wp-meta { color: #696969; display: inline-block; flex: 2 1 50%; font-size: .875em; line-height: 1.5em; margin: 0 0 1.5em; padding: 0; }
.amp-wp-article-header .amp-wp-meta:last-of-type { text-align: right; }
.amp-wp-article-header .amp-wp-meta:first-of-type { text-align: left; }
.amp-wp-byline amp-img, .amp-wp-byline .amp-wp-author { display: inline-block; vertical-align: middle; }
.amp-wp-byline amp-img { border: 1px solid #0a89c0; border-radius: 50%; position: relative; margin-right: 6px; }
.amp-wp-posted-on { text-align: right; }
/* Featured image */
.amp-wp-article-featured-image { margin: 0 0 1em; }
.amp-wp-article-featured-image amp-img { margin: 0 auto; }
.amp-wp-article-featured-image.wp-caption .wp-caption-text { margin: 0 18px; }
/* Article Content */
.amp-wp-article-content { margin: 0 16px; }
.amp-wp-article-content ul, .amp-wp-article-content ol { margin-left: 1em; }
.amp-wp-article-content amp-img { margin: 0 auto; }
.amp-wp-article-content amp-img.alignright { margin: 0 0 1em 16px; }
.amp-wp-article-content amp-img.alignleft { margin: 0 16px 1em 0; }
/* Captions */
.wp-caption { padding: 0; }
.wp-caption.alignleft { margin-right: 16px; }
.wp-caption.alignright { margin-left: 16px; }
.wp-caption .wp-caption-text { border-bottom: 1px solid #c2c2c2; color: #696969; font-size: .875em; line-height: 1.5em; margin: 0; padding: .66em 10px .75em; }
/* AMP Media */
amp-carousel { background: #c2c2c2; margin: 0 -16px 1.5em; }
amp-iframe, amp-youtube, amp-instagram, amp-vine { background: #c2c2c2; margin: 0 -16px 1.5em; }
.amp-wp-article-content amp-carousel amp-img { border: none; }
amp-carousel > amp-img > img { object-fit: contain; }
.amp-wp-iframe-placeholder { background: #c2c2c2; background-size: 48px 48px; min-height: 48px; }
/* Article Footer Meta */
.amp-wp-article-footer .amp-wp-meta { display: block; }
.amp-wp-tax-category, .amp-wp-tax-tag { color: #696969; font-size: .875em; line-height: 1.5em; margin: 1.5em 16px; }
.amp-wp-comments-link { color: #696969; font-size: .875em; line-height: 1.5em; text-align: center; margin: 2.25em 0 1.5em; }
.amp-wp-comments-link a { border-style: solid; border-color: #c2c2c2; border-width: 1px 1px 2px; border-radius: 4px; background-color: transparent; color: #0a89c0; cursor: pointer; display: block; font-size: 14px; font-weight: 600; line-height: 18px; margin: 0 auto; max-width: 200px; padding: 11px 16px; text-decoration: none; width: 50%; -webkit-transition: background-color 0.2s ease; transition: background-color 0.2s ease; }
/* AMP Footer */
.amp-wp-footer { border-top: 1px solid #c2c2c2; margin: calc(1.5em - 1px) 0 0; }
.amp-wp-footer div { margin: 0 auto; max-width: calc(100% - 32px); padding: 1.25em 16px 1.25em; position: relative; }
.amp-wp-footer h2 { font-size: 1em; line-height: 1.375em; margin: 0 0 .5em; }
.amp-wp-footer p { color: #696969; font-size: .8em; line-height: 1.5em; margin: 0 85px 0 0; }
.amp-wp-footer a { text-decoration: none; }
.back-to-top { bottom: 1.275em; font-size: .8em; font-weight: 600; line-height: 2em; position: absolute; right: 16px; }
.amp-wp-container { width: 100%; margin: 0 auto;}
</style>