Closed book closed 8 years ago
Seems solid to me. Problem is, you would need to remember this template condition in every template. What if this was moved to a function that generates the URLs? It could internally use uri_for
and add .html
if the static
setting is on.
I agree 100%. Like I said in the description, "a cleaner approach" is to add the .html
extension is in some URL-generating method.
Adding methods for generating URL will simplify the templates in any case, so I'm going to do that in another PR.
The goal is to be able to run the full version of the blog (with login, admin, post, etc. capabilities) on an internal site, and to publish the blog on a static Internet-facing web site. This way, it's possible to have the best of both worlds: a rich web application to manage the blog, and a safe, simple static web site to publish it.
This is done with a single extra setting:
static
. When set to a true value, the templates will hide all the "dynamic" elements of the application.A lot of the templates have been modified to add the
.html
extensions with this piece of TT code:[% settings.static && '.html' %]
. A cleaner approach, that would not require so much template changes, would be to give the various application objects one or more methods to return the URL. That way, the addition of the extension would be handled entirely in the code, and not in the templates.