Statocles icon indicating copy to clipboard operation
Statocles copied to clipboard

Fix template variables system

Open preaction opened this issue 9 years ago • 0 comments

Right now we pass a bunch of variables into the templates, including the page, site, content, and any other random things. This makes the templates less than friendly, less performant (templates need to be recompiled often) and also makes template helpers harder to develop (like Statocles::Plugin::Highlight).

Mojolicious puts everything on the "context" ($c), and that seems to work pretty well. We could have the same thing with the page object, along with helpers to pull individual useful bits out of the page object.

The special-case of the document being a template would be a potential problem, but we could always call that self or document.

If we use helpers more and variables less, we can modify how things are done more easily without breaking things. But helper authors will get broken no matter what.

preaction avatar Jan 02 '16 04:01 preaction