Update the cache of the Home of my website when a new article is published

Hello, how can I update the home cache of my website when a new article is published?

Currently we do it manually, entering the url of the site, so it is updated.

Can it be done automatically and not affect

Thank You

1 Like

Depending on what CMS, SSG etc you use, the approach would be different, some even support automatic cache purges.

But to solve the problem independendly you could do this:

  1. make sure you can catch and hook into the event “publish article”
  2. write a script that uses Cloudflares API to purge the target URL (eg. https://www.domain.tld)
  3. execute the script everytime the event “publish article” occurs. Sometimes you have the abillity to chain something onto this event.

Thats it.

2 Likes

Mmm, Hello, we use WordPress, but we are lost about the script.

Our site is https://cultura-informatica.com/

Could you please help us…thank you!

That mentioned I would recommend APO. If APO does not support this you can open a FeatureRequest with a ticket and ask the devs to support “Purge Cache on related pages”. If it ATM does support it or not I can not answer since I don’t use WordPress at all.

2 Likes

If we have OPO enabled.

Then I might should add @yevgen, maybe he can give you some insights on if that feature will come or not at all, or even if it already is available and you have configured something wrong.

Excuse me, we are new to CloudFlare, where we need to add the user @yevgen

Nowhere. That’s a community name. You don’t need to do anything, than to wait, untill he (or any other user who is familiar with APO) replies and provides you with the info about:

  1. if that is possible with APO ATM.
  2. if that may is planned and will be supported in the future.

Untill then stay patient and wait.

Thanks for using the community.

3 Likes

Ah okay! :slight_smile:

I suggest you provide own filter for cloudflare_purge_by_url hook. Cloudflare-WordPress/cloudflare.loader.php at 05807ab419d248188adee861eab5b8d3146bc721 · cloudflare/Cloudflare-WordPress · GitHub. Just add home page to the list if it’s not where already.

4 Likes

Where we have to enter all this code. We replace the url with our domain surely

Sorry for the inconvenience, we do not understand the cloudflare issue well

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.