7

Is there an option for storing the pages generated by Craft CMS as flat, static HTML files?

The model used by static driver from ExpressionEngine's CE Cache add-on works pretty well:

Each page request hits a mod_rewrite rule, which checks to see if an HTML file for that page exists in the static cache directory.

If said file exists, it gets served to the browser.

If the file doesn't exist, the CMS generates the output, which is then saved as a cache file for the next user who hits that URL.

It only works in cases where the entire page can be saved, but, it's insanely fast and pretty easy to implement compared to other caching solutions.

... is there anything like that available for Craft CMS?

1
  • 1
    FYI: I've been working on a flat, static HTML Cache for Craft. It busts the cache after an hour or when an entry has been updated. It is currently in beta, could use feedback :) github.com/craftapi/htmlcache
    – chris
    Commented Feb 26, 2016 at 14:23

3 Answers 3

8

Someone has recently developed a standalone static HTML caching plugin for Craft CMS which does similar to what you're after:

HTML Cache plugin for Craft CMS

This Craft plugin will generate static HTML files for your website. No need for Reddis/Varnish setups anymore!

  • Improves the speed drastically: 300-1500MS to 2-50MS (depending on server setup) if ubercache is enabled from the settings page
  • Busts the cache automatically when an entry has been updated
  • Cache duration time can be set; defaults to 3600 seconds (1 hour)
  • Active development and support through Craft's Slack

NOTE: This plugin is still in beta, so please test if this plugin works as expected on a development environment before pushing to a production site.

1
  • Just note that it appears to bust the entire cache when updating an entry. If you have hundreds or thousands of pages on your site, this might be a significant downside.
    – Simon East
    Commented Oct 11, 2018 at 3:22
3

You can also implement FastCGI Cache for static page caching pretty easily; check out:

Static Page Caching with Craft CMS

1
  • +1 more people need to know about nginx's fastcgi_cache, a great gem IMO. Commented Jun 28, 2017 at 22:40
2

Nothing that I'm aware of and a scan through Straight Up Craft's plugin directory isn't revealing anything, either.

There are, however, some that integrate with Fastly and Varnish, where you could do all sorts of static caching strategies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.