AMP
Thing with AMP and pages & rewrite endpoints
AMP bugs & improvements on save-up.ch | Trello Add support for Archive / Authors / Tags and pagination by gabrielperezs · Pull Request #313 · Automattic/amp-wp Rewrite API/add rewrite endpoint « WordPress Codex Add rewrite endpoint to author page + pagination - WordPress Development Stack Exchange
Datenschutz | save-up.at - smart shopping Comparing Automattic:master…gabrielperezs:master · Automattic/amp-wp Add support for pages by technosailor · Pull Request #188 · Automattic/amp-wp Topic: /amp/ permalink not working? « WordPress.org Forums Automattic/amp-wp: WordPress plugin for adding AMP support
Rewrite endpoints API – Make WordPress Plugins Topic: Custom rewrite approach with add_rewrite_endpoint() « WordPress.org Forums wp refresh permalinks add rewrite endpoint - Google Search Rewrite endpoints API – Make WordPress Plugins A (Mostly) Complete Guide to the WordPress Rewrite API - PMG - Advertising Agency
Improve official AMP plugin
WordPress & AMP: part II • Yoast
-
Glue for Yoast SEO & AMP is used for:
- Enable/disable AMP on content types. Very simple.
- Google Analytics Integration. Gives perfect total control!
-
- AMP Menu Support, perfectly implemented Other tweaks, not needed: Google Analytics to AMP, Post type support, Remove footer (removed from plugin for now)
Others:
-
AMP Analytics Google Analytics
-
AMP Toolbox Google analytics
-
AMP HTML Sitemap Not needed as AMP Pages Don’t Need Google Sitemap XML Files Interesting. You can also use this URL to add it manually to be indexed via Google Webmaster Tools.
-
Custom AMP (no) Not using! OMG, this is one badly written plugin!
- Change AMP Endpoint (doesn’t have it)
- Google Analytic code for AMP (I have it in Yoast)
- Add Menu for AMP Pages (find another solution)
Plugin that add no extra value to WP AMP:
-
AMP Author Box adds Author JSON-LD to AMP pages.
Shortcodes and AMP:
- Integrating AMP into WordPress: A Comprehensive Guide – Make XWP
- Filtering WP Shortcodes to comply with AMP standards. · GitHub
How to force update of AMP pages in AMP Cache?
First, extract all AMP pages with Screaming Frog’s custom extraction using //link[@rel='amphtml']/@href
as XPath, and
save URLs as file files.txt
.
Based on this document: Update AMP Content, simplest to do is this:
https://cdn.ampproject.org/c/s/www.save-up.ch/gutschein/ikea/accp/
And we can also do this (the only way to delete content):
https://cdn.ampproject.org/update-ping/c/s/www.save-up.ch/gutschein/ikea/accp/
So, let’s try to automate reading list of URLs from file:
sed -e 's/^https:\/\///' files.txt | xargs -i curl -sL -w "%{http_code} %{url_effective}\\n" https://\{\} -o /dev/null
Windows:
sed -e 's/^https:\/\//https:\/\//' files.txt | xargs -i curl -sL -w "%{http_code} %{url_effective}\\n" \{\} -o /dev/null
Linux, in parallel:
sed -e 's/^https:\/\//https:\/\//' files.txt | \
parallel --no-notice --pipe -L 30 \
curl -sL -w "%{http_code} %{url_effective}\\n" \{\} -o /dev/null
This is my final process:
# Just read URLs
sed -e 's/^https:\/\//https:\/\//' files.txt | xargs -i curl -sL -w "%{http_code} %{url_effective}\\n" \{\} -o /dev/null
# Update cache, in AMP Cache URL format
sed -e 's/^https:\/\///' files.txt | xargs -i curl -sL -w "%{http_code} %{url_effective}\\n" https://cdn.ampproject.org/c/s/\{\} -o /dev/null
# Slightly faster cache update, in Update ping format
sed -e 's/^https:\/\///' files.txt | xargs -i curl -sL -w "%{http_code} %{url_effective}\\n" https://cdn.ampproject.org/update-ping/c/s/\{\} -o /dev/null
That’s it.
Sources: