[Neos] Order of Scripts and Tags in head

Henjo Hoeksma henjo at simplyadmire.com
Tue Nov 11 14:50:41 CET 2014


On 2014-11-11 12:56:47 +0000, Maxi milian said:

> As indicated in the example below, I would expect that the output is as 
> follows:
> 1. metadata
> 2. stylesheets
> 3. javascript
> 4. title
> 
> But it is:
> 1. title
> 2. javascript
> 3. stylesheets
> 4. metadata
> 
> How could I change the order of scripts and meta-tags in head?
> 
> ---
> 
> Typoscript:
> page = Page {
>   head {
>     metadata = TYPO3.TypoScript:Template {
>       templatePath = 'path/to/template'
>       sectionName = 'metadata'
>     }
> 
>     stylesheets.site = TYPO3.TypoScript:Template {
>       templatePath = 'path/to/template'
>       sectionName = 'stylesheets'
>       node = ${node}
>     }
> 
>     javascripts.site = TYPO3.TypoScript:Template {
>       templatePath = 'path/to/template'
>       sectionName = 'headScripts'
>       node = ${node}
>     }
> 
>     titleTag = TYPO3.TypoScript:Tag {
>       tagName = 'title'
>       content = ${q(node).property('title') + ' - Website Name'}
>     }
>   }
> }
> 
> Template:
> <head>
>   <f:section name="metadata">
>     [...]
>   </f:section>
> 
>   <f:section name="stylesheets">
>     [...]
>   </f:section>
> 
>   <f:section name="headScripts">
>     [...]
>   </f:section>
> </head>
> 
> Example:
> <head>
>   <title>Home - Website Name</title>
>   <script type="text/javascript" src="path/to/javascript.js"></script>
> 
>   <link rel="stylesheet" href="path/to/stylesheet.css" media="all" />
> 
>   <meta charset="utf-8"/>
>   <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
>   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
>   <meta name="viewport" content="width=device-width, initial-scale=1, 
> maximum-scale=1">
> 
>   <link rel="shortcut icon" href="path/to/favicon.ico" 
> type="image/x-ico; charset=binary">
> </head>

When you check the TYPO3.Neos:Page object in the 
TYPO3.Neos/Resource/Private/Typoscripts folder you can see you can use 
'before*' or 'after*' statements to order your output.

-- 
Kinds regards,

Henjo



More information about the Neos mailing list