How to Update Google AMP Cache

Wondering how to update Google AMP Cache? It’s easy. And maybe unnecessary. Here’s how and why.

How to Update Google AMP Cache.So you’re using Google AMP. Cool, good for you. We do too. Just about everyone should.

Maybe it’s you’re trying to benchmark your long-tail SEO after Google’s BERT update.

Whatever the reason, you probably hate the way your AMP pages look. Yea, we did too.

So you start messing with the design and layout and you finally get your Google AMP pages looking good.

All set, right?

Maybe not. We all know Google like to take its time on reindexing URLs. The same is true with AMP:

AMP URLs are cached. We don’t know when—or even if—the cache is refreshed on its own. YMMV. That’s because the AMP cache is updated on the fly, following a “stale-while-revalidate” model.

What does that mean?

Read on.

(By the way: you could always hire an admin on Fiverr or something to do this for you!)

Update Google AMP Cache

If you’ve been googling queries like “how to flush Google AMP cache” or anything like that, you’ve probably seen this page:

Update Google AMP Content Documentation.

It’s Google’s documentation on AMP’s update-ping mechanism: it’s how you can force AMP to refresh its cache.

So let’s look at exactly how to do it. It takes a few steps, and they’re not all explained on the same website. So we’ve collected them for you. We got you, fam.

1. Copy AMP Cache URL

[script src=”https://gist.github.com/gitmxt/15339b5dc3a55ec1c2579735cc3515bf.js”]

This the the magical URL that tells AMP to refresh its cache. It’s actually just the URL to show the cache, but because of that “stale-while-revalidate” model, it also triggers a cache update.

There are actually 2 ways to send that refresh command to AMP, one “stronger” than the other, but we’ll only need the first one.

Here’s what Google says:

The easiest way to update the version of any AMP document stored in the Google AMP Cache is to make a new request to access that document using the AMP Cache URL format.

Ok, so far so good. It makes you wonder what the AMP Cache URL format is, but we’ll get there.

Unsure if you got that AMP Cache URL right?

Use this free tool at ampbyexample.com.

Google AMP Cache URL Converter Tool.

 

2. Load your cached AMP page in a browser

It’s that simple.

Most people who understand AMP—beyond the typical “AMP is like faster mobile pages, right?” generic responses—will tell you that this is really all you need to do. The AMP cache updates when you complete this step. And for the most part they’re right.

AMP By Example: Update Cache.

Google’s documentation goes on to say…

The Google AMP Cache automatically requests the latest version of the AMP document from its origin…and serves the updated version to the next user.

There it is.

That means that when you load the AMP Cache URL directly, that forces the cache to update, even without the more “urgent” update ping method. No special command to run via an API somewhere. Just load the URL in a browser.

But there’s a catch.

3. Visit again in new tab, browser, or device

The cache will be refreshed but the new AMP page will be shown to the next user, not to you. This is what “stale-while-revalidate” means.

There’s an easy workaround, obviously. Make sure you ARE the next user. Just close the tab and reopen it, or access from a different browser/device, and you’re all set.

Google considers a document “fresh” for at least 15 seconds after it’s uploaded or edited, which means they won’t refresh the document until after that 15 seconds is over.

So be patient.

Meanwhile, on the internet

There’s some discussion on this topic at StackOverflow that may benefit readers of this blog too.

Update Google AMP: StackOverflow Answer.

User Dan Dascalescu’s answer is actually not the accepted “correct” answer, but it probably should be.

Update Google AMP: StackOverflow Wrong Answer.The accepted answer is wrong.

It says “no, there is no API to force a new copy of an AMP page in the Google CDN.” But that’s untrue, as we’re learning in this post and in Google’s documentation.

And the StackOverflow community knows it.

The green checkmark means it’s the “accepted” answer (marked by the author of the question). But the -1 means the rest of the StackOverflow who’ve voted on the answers know what this answer is junk.

Need a hand?

If you’re struggling with Google AMP, updates to the cache, removing your URLs from the index, or any of that, we can help!

Get in touch and we’d be happy to work through for (or with) you.

Bonus: DO NOT remove AMP URLs.

Unless you’re 100% sure that’s what you want to do, it’s a bad idea to remove your AMP URLs from the cache. If you do remove them, be very careful.

Again, Google says…

Important: Removal of content from the Google AMP Cache will not immediately cease traffic flowing to removed content, which may result in user-facing errors such as 404 or 500.

That’s a big deal. And there has been plenty of discussion about it since AMP came out (that post has 70,000+ views).

Update Google AMP: Remove URL Error.
Screenshot borrowed from shkspr.mobi.

Why? What’s the problem?

Well, it turns out that once your AMP pages are in the index, Google seems reticent to let go of them.

The documentation says clearly that even if you update ping remove them, they still take some time to disappear.

And even once that happens, the AMP error page links to the old, now-invalid /amp URL, returning a 404.

For example, Google Search may link to the AMP versions of pages even after you use “update-ping” to remove the page from the Google AMP Cache because the index still indicates that an AMP page is available and may take time to become aware of the removal.

Yes, you can add a redirect in your htaccess or with a plugin, but it shouldn’t be the author’s job to fix AMP’s mistakes.

AND, as pointed out by @edent in the link above, you have to run update ping individually on every URL. For some sites, that’s thousands of one-at-a-time update pings.

No thanks.

The smart money says stick with AMP unless you have good reason not to.

So should I update my AMP pages or not?

Now What?

Yes. The WordPress AMP plugin is a good start, but it’s lacking some important things like style options, social sharing buttons, and a link to the non-AMP version.

We’ve already had to retrofit some of our clients’ websites with those features because the AMP plugin isn’t good enough.

The update is easy if you know where to look.

As always, I wish Google would make their documentation a little clearer and easier to use.

Need a hand?

If you’re struggling with Google AMP, updates to the cache, removing your URLs from the index, or any of that, help is out there!

You could always hire an admin on Fiverr or something to do this for you!

11 thoughts on “How to Update Google AMP Cache

  1. Dani Buller

    Hi there,
    I’m trying to remove some pages from amp-cache and i’m following the instructions on https://developers.google.com/amp/cache/update-cache
    I’ve done everything as stated and created the signature.bin file.
    In the next phase I’ve encoded it to base64 using this code: Buffer.from(signature).toString(‘base64’);
    And then tried to verify it using this command:
    “openssl dgst -sha256 -signature signature.bin -verify public-key.pem url.txt” which failed.

    Questions:
    1) is the encoding done right?
    2) Am I supposed to verify the original signature.bin file or the encoded one?

    Thank you very much,
    Dani

    Reply
    1. TJ Kelly

      To be honest, @danibuller:disqus, we’ve never needed to go down that road. So I’ve never tried it! Paul Shapiro at SearchWilderness.com has done some amazing work w/ AMP. Give him a shout. @fighto on Twitter.

  2. Jack Richard

    Hi
    Lots of my pages has been changed during past week as my pages updates occasionally Should I clear their caches one by one or there is another solution?

    Reply
    1. TJ Kelly

      I don’t think you’ll need to at all, @disqus_7UYFGA6KFK:disqus. Manually updating will trigger it to happen faster than it would on its own, but it will eventually happen on its own.

      Depending on how many pages you’re talking about, maybe you could manually update the important ones one at a time, and wait for the rest of them to update on their own?

      Beyond that, I’m afraid I don’t have a great answer!

    2. Jack Richard

      Hi again
      Thanks for your answer @tjkelly:disqus .Actually I’m talking about at least 25K pages. Every week about 1K pages might change.And It’s very important that cache of this pages updates immediately.
      So I’m still looking for a good solution.
      Thanks

  3. Jhelum Sen

    It is a serious issue. Thanks for sharing the info. The fact is Google does not index AMP pages, but it is hard to remove cache. With the new SEO update of mobile-first indexing it has become obvious that if you have both AMP and non AMP pages Google is likely to index the non AMP version of the website. Though Google is giving privilege to AMP by incorporating as AMP stories and Gmail AMP. I have learned about AMP latest news from http://www.techmagnate.com/blog/amp-news-2018-latest-accelerated-mobile-pages-updates-news/ this post. Sharing for the reference of others.

    Reply
    1. TJ Kelly

      Yes, it will update itself periodically. This process makes it happen faster/on-demand. But it’s not necessary to do this, if you don’t mind waiting.

      Thanks for commenting!

  4. babychen

    I tested this after making edits in the content of some AMP URLs. It works, but not reliably. In one instance, the edited content appeared in the AMP version in 15-20 seconds. In another, after 5 minutes, there was no change. I stopped checking and after 30 minutes when I checked, yes it had changed.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *