AMP

外掛說明

The AMP Project is an open-source initiative aiming to make the web better for all. AMP enables web experiences that are consistently fast, beautiful and high-performing across distribution platforms. The Official AMP Plugin for WordPress supports fully integrated AMP publishing for WordPress sites, with robust capabilities and granular publisher controls.

Features and capabilities provided by the plugin include:

  • Compatibility Tool: to assist the development of AMP experiences by enabling AMP debugging with detailed information about validation errors that may exist, the markup/scripts causing them, and the specific components on site (e.g theme, plugin, core) responsible for that page content.
  • CSS Tree Shaking: to assist in dealing with cases where the defined CSS rules on a site exceed the CSS size limit allowed on single AMP pages.
  • Core Theme Support: enabling full AMP validity for four default themes (i.e. Twenty Fifteen, Twenty Sixteen, Twenty Seventeen, Twenty Nineteen).
  • Gutenberg Support: enabling AMP content creation fully integrated with Gutenberg.
  • AMP-first Experiences support: enabling full-site AMP experiences without sacrificing the flexibility of the platform, or the fidelity of content.
  • Many Optimizations: A myriad of code, performance, and developer experience improvements: from customization flexibility, to better UI flows, internationalization, accessibility, etc.

The plugin can be configured to follow one of three different template modes: Native, Transitional, and Reader. When configured to operate in Reader and Transitional modes, a given post/page will have a canonical URL as well as a corresponding (paired) AMP URL. The AMP plugin is not serving as a mobile theme; it does not redirect mobile devices to the AMP version. Instead, the AMP version is served to mobile visitors when they find the content on platforms such as Twitter, Pinterest, Google Search, and others.

With the official AMP plugin for WordPress, the WordPress ecosystem is provided with the capabilities and tools it needs to build world-class AMP experiences without deviating from its standard, flexible, and well-known content creation workflow.

Getting Started

To learn more about the plugin and start leveraging its capabilities to power your AMP content creation workflow check the official AMP plugin product site.

If you are a developer, we encourage you to follow along or contribute to the development of this plugin on GitHub.

螢幕擷圖

  • Theme support enables you to reuse the active theme's templates and stylesheets; all WordPress features (menus, widgets, comments) are available in AMP.
  • Many themes can be served as AMP without any changes; the default experience is as if JavaScript is turned off in the browser since scripts are removed.
  • Reader mode templates are still available, but they are are limited. Not only do they differ from the active theme, any validation errors are silently sanitized.
  • Switch from Reader mode to Transitional or Native mode in AMP settings screen. You may need to disable the admin bar in AMP if your theme has a larger amount of CSS.
  • Make the entire site available in AMP or pick specific post types and templates; you can also opt-out on per-post basis.
  • Plugin checks for AMP validity and will indicate when either: no issues are found, new issues need moderation, or issues block AMP from being served.
  • The editor will surface validation issues during content authoring. The specific blocks with validation errors are indicated.
  • Validated URLs include the list of validation errors encountered, giving control over whether sanitization for a validation error is accepted or rejected.
  • Styles added by themes and plugins are automatically concatenated, minified, and tree-shaken to try to keep the total under 50KB of inline CSS.
  • A WP-CLI command is provided to check the URLs on a site for AMP validity. Results are available in the admin for inspection.

安裝方式

  1. 將外掛壓縮檔解壓縮後,將資料夾及其所有檔案上傳至 /wp-content/plugins/ 目錄。
  2. 透過 WordPress 的 [外掛] 選單啟用外掛。
  3. If you currently use older versions of the plugin in Reader mode, it is strongly encouraged to migrate to Transitional or Native mode. Depending on your theme/plugins, some development work may be required.

使用者評論

AMP issues detected by Google search console

I activated the AMP using your guide. In the them panel–> mobile settings, I activated the Mobile + AMP use- Now, all my websites, all with newspaper have an issue with the search console of google. The issues in the google search console are: 1) The tag ‘noscript enclosure for boilerplate’ appears more than once in the document. 2) Only amp-boilerplate and amp-custom ‘style’ tags are allowed, and only in the document head. What is wrong? The performance are actually improved, but in 24h I received this issue. Can you help me? Thank you

Great Plug & Play AMP Plugin

I have used this on many different themes both for my own projects, as well as clients at the agency I work for. This plugin is great out of the box, but also highly extensible. We've had a really good experience with this overall.

Version 1.0.2 good but above version bad in the sense

Version 1.0.2 is good that's what I am using but one error (CSS code working good in non-amp but same not working fine in amp before "Version 1.0.2" was all fine but not others are fine, FIX IT) NEXT after "Version 1.0.2" there's one error it's creating 3-4 lines unnecessary spaces between "featured image and the top text of the post" which is very unattractive. FIX THIS MOST IMPORTANT. Others fine till now Waiting for fixing considering above issues in your next update I am still using the previous "Version 1.0.2" (which still contains CSS difference error for the amp and non-amp) Most important note for any Plugin Users Before updating any plugin make the backup (Updraft plus back up plugin is the best as a free tool) and restore (if plugin updated then restore only plugins, not a whole site to do faster recovery) if the problem exists. Or Use "WP rollback" wp plugin to roll back to the previous version of any updated plugin. that's what prevents me from breaking up my site. (Using this restoring from the backup plugin is not needed)

It broke my blog

I installed the plugin, activated it, reviewed the settings and emptied the cache so that it would take effect. I checked with the AMP Validator and hell yeah it was a valid AMP page. But my blog was broken. The header image became a background image. And scrolling down I could see the menu as a element (bullets and all) and the images of the posts that appear in the front page. Nothing else, no text, no widgets, nothing. Absolutely useless.

Did absolutely nothing except waste my time

This plugin does, literally, NOTHING. It doesn't create AMP pages. You plug it in, set it up, and nothing happens. AMP validators continue to tell you your site is not AMP enabled. Adding /amp/ to any URLs gives a 404. So you try changing the settings. Same thing. Native, transitional, reader, it doesn't matter: this plugin does NOTHING. It sure doesn't give you AMP pages. If you want to waste your time, go ahead. Me, I'm pissed.
閱讀全部 170 則使用者評論

參與者及開發者

AMP 外掛目前已有 18 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

將 AMP 外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

For the plugin’s changelog, please see the Releases page on GitHub.