What is dynamic content?
It can be easily described as content that changes its behavior based on several factors. The factors can be the user’s interests, location, engagement with the website, pre-defined timestamps, and more.
Examples of dynamic content
Let’s look at an online platform for bidding. Such websites should be dynamic because the visitor tracks the current bid constantly, and the information should always be precise and up-to-date (Live).
Another example is E-commerce websites. Let’s say you want a suggested products section on your homepage. Then you will need to make sure you serve different items for each user based on their browsing preferences. If a user is looking for watches in your store, it would be best if they don’t get offered shoes.
Is NitroPack compatible with dynamic content?
Unfortunately, there isn’t a definitive answer.
It strongly depends on how dynamic content was implemented on your website. Based on that our service can tackle it in several different manners.
Let’s flip through the most popular cases below ⬇️
Dynamic content entirely based on PHP scripts
There are several examples here:
1️⃣ Countdown timers / Dynamic dates
Upon fetching the page content for optimization, our service will cache the current state of the timestamp.
That means that each new visit of the cached page will serve the state of the optimization, which may look like a reset in the timer.
2️⃣ Product/Gallery changes
If you want to serve new stock with each refresh of the page, our service will be able to serve only the items it has seen and cached.
When the counter is injected with PHP code into the HTML, it is then cached by us and not dynamically updated upon adding products to the cart.
4️⃣ Publishing new content via third-party service
NitroPack is compatible with most builders, and the cache will be refreshed with each new item added.
However, some services do not use the default POST method and simply make direct edits to the files. Our service does not have a way to detect such changes and will simply serve the latest cached version of the page.
An example of such a service/plugin would be: Online Buchungssystem – edoobox
In this plugin, the content is not fully stored in WordPress but rather in a third-party service and injected dynamically in WordPress pages; therefore, changes to the content stored on their server would not be detected by NitroPack.
How to tackle this behavior?
Check if the plugin is compatible with caching at all. Some plugins have that compatibility information hidden, and you should consult with the support team that is responsible for the product.
Refresh the cache for the pages that use the plugin on a given time period.
For WordPress, you can use our WP CLI in combination with Cron Job from the server.
Check the following article:
How to use WP-CLI with NitroPack
Dynamic content based on PHP scripts and cookies
For example, a third-party plugin may set a cookie to detect and store your current geolocation to show you content in your specific currency or language.
What can cause the issue here is if the plugin is dynamically changing the content using PHP.
As mentioned above, the PHP code will not execute again on cached pages and will serve the already cached page, no matter that the cookie is correctly presented.
How to tackle this behavior?
Our service provides a function called “Dynamic content cookies”.
By using it, you will be able to make your PHP dynamic content based on cookies compatible with NitroPack: