class AppendingRespectLayoutTitleStrategy extends Object
A special version of the AppendingStrategy sorter that respects the
position of the <title> element within the layout page.
The default behaviour of the layout dialect has historically been to place
the <title> element at the beginning of the <head> element
during the decoration process; an arbitrary design decision which made
development of this library easier. However, this runs against the
expectations of developers who wished to control the order of elements, most
notably the position of a <meta charset...> element. This sorting
strategy instead keep <title>s wherever they exist within the
target/layout template being decorated, and then appending everything else as
normal.
This will become the default behaviour of the layout dialect from version 3.x onwards, but was introduced in 2.4.0 to be a non-breaking change.
| Type Params | Return Type | Name and description |
|---|---|---|
|
int |
findPositionForModel(IModel headModel, IModel childModel)For <title> elements, returns the position of the matching
<title> in the headModel argument, otherwise returns the
position at the end of the <head> section. |