stephenkeable
stephenkeable

Is it possible to access a variable within the YAML section of a page?

For example I have a variable that is set in the backend using the theme form fields, within the HTML portion of the page I can use {{ this.theme.var_name }} to display it, however I'd also like to display this mid way through the page title, which is defined in the YAML portion of a page template. This doesn't work:-

title: "Some text {{ this.theme.var_name }} some more text"

stephenkeable
stephenkeable

Ended up working around this using the PHP section of a page:-

<?php
function onEnd() {
$this->page->title = "Title" . $this->theme->var_name. " with variable in";
}
?>

Or the page meta description:-

<?php
function onEnd() {
$this->page->description = "Description " . $this->theme->var_name. " with variable in";
}
?>

1-3 of 3