Glog
Glog copied to clipboard
Passing variables to the templates
/cc @wlaurance
Currently, introducing new variables into the template can only be done by editing the Glog core code. I would like to propose a change to allow users to:
- Pass custom variables from the config file to the template (e.g. tracking ids)
- Pass custom variables from an article to the template (e.g. article image, references)
This could be achieved by adding a 'user' section to the config file e.g.
{
"blog_repository" : "[email protected]:guyht/Guido.git",
"author" : "Glog",
"blog_title" : "The Glob Blog",
"port" : 8080,
"base_url" : "",
"cache_time" : 28800,
"articles_per_page" : 10,
"show_author" : false,
"plugins" : [],
"user" : {
"custom-analytics-id" : "123",
"custom-template-var" : "var"
}
}
The user variable would be passed through to the template, giving the user access to all the variables defined in its scope.
Custom variables for articles would work in exactly the same way.
Opening for discussion
This also looks good to me. :+1: