3 ms·
Pretty much. Only chances are it's not actually manual, either. The way I do this for the CMS/Blog stuff on my products is to set up a 404 handler that looks
by jasonkester 15y ago
Pretty much. Only chances are it's not actually manual, either.
The way I do this for the CMS/Blog stuff on my products is to set up a 404 handler that looks for urls that seem like they should be blog entries. So if it sees a request for the non-existant http://mysite.com/blog/caching_is_awesome.html http://mysite.com/blog/caching_is_awesome.html, it'll do a quick check for that article in the database, and if necessary create the static .html file before redirecting to it.
It's a little nicer than caching because you only need ever lookup/create the thing once each time it changes. From there, it's just the webserver being a webserver. No need to involve any application layer at all.
- danneu 15y agoEven a minimal blog written in Rails can cache to .html files with a page caching line in the PostsController and some lines for expiration when new posts are created/updated/destroyed.
- crdoconnor 15y agoWhy not go the whole way and only edit/serve up the static file instead of the database entry? That has the added benefit that you can use version control on it.
- philwelch 15y ago> The way I do this for the CMS/Blog stuff on my products is to set up a 404 handler that looks for urls that seem like they should be blog entries. So if it sees a request for the non-existant http://mysite.com/blog/caching_is_awesome.html http://mysite.com/blog/caching_is_awesome.html, it'll do a quick check for that article in the database, and if necessary create the static .html file before redirecting to it. You have done the webserver equivalent of method_missing trickery in Ruby.