snipper overwritting something in the <head> section

13 days ago

mkoula
Generous Backer | 31
+
0
-

I would like to change title and meta robots tag in the <head> section, but I am having some troubles.
I created snippet:

<head>
<title n:snippet="htmlTitle">{$htmlTitle}</title>
<meta n:snippet="metaRobots" n:if="$robots" name="robots" content="{$robots}" />
...
</head>

in my presenter I have action:

public function handleLoadResults()
{
    if ($this->isAjax()) {
        $this->template->htmlTitle = 'Page 2';
        $this->template->robots = 'noindex, follow';

        $this->redrawControl('htmlTitle');
        $this->redrawControl('metaRobots');
    }
}

The thing is that those two snippets are not updated – the AJAX response has them as an empty string, but if I will use bdump() in the beforeRender method I can see the changes there…

I just tried to create snippet on the <head> tag and redrawControl on this snippet and then the title and robots snippets are updated, but this is a bit problematic because of so many js/css and other declarations and I can not do the snippet around <meta> tag in the head because there's no possibility to have div…

Is there any way?