AMP

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:

    1. Enable/disable AMP on content types. Very simple.
    2. Google Analytics Integration. Gives perfect total control!
  • AMP Post Script

    1. AMP Menu Support, perfectly implemented Other tweaks, not needed: Google Analytics to AMP, Post type support, Remove footer (removed from plugin for now)

Others:

Plugin that add no extra value to WP AMP:

Shortcodes and AMP:

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:

date 01. Jan 0001 | modified 28. May 2021
filename: Task - AMP