content_processor.html_head

SummaryInserts various HTML tags like links to CSS/Javascript files into the HTML head tag
Short namehtml_head
Content typetext
Provided by bundlebuilt-in
API docWebgen::ContentProcessor::HtmlHead

Description

This processor is used to insert HTML tags (link, script and meta) that are specified by extensions or via special node meta information keys before the end of the HTML head section.

Usage

This content processor should be used on template files since its output is only useful in the head section of an HTML file. And it should be the last content processor in the processing pipeline because otherwise not all needed information may be set!

Also note that there is no need for a special markup since the HTML head end tag is unique in a HTML document and therefore the insertion place can be found automatically. This also means that nothing is done by this processor if the closing </head> HTML tag is left out!

Handled HTML Tags

The tags that are inserted can be specified in various ways:

  • Links to used javascript and CSS files, inline javascript and CSS content and general meta tags can be set during the rendering of a page file by any extension on a page-per-page basis.

    This is accomplished by using the context.html_head object (an instance of Webgen::Context::HtmlHead::Proxy). It provides utiltity methods for all possibilities.

  • Arbitrary meta tags can be inserted on a page-per-page basis by the user by setting the  meta meta information on a page file.

  • Links to javascript and/or CSS files can be inserted by the user by setting the  link meta information.

  • Arbitrary link tags can also be inserted by setting the  link meta information. This allows one, for example, to specify which page file logically follows or precedes a given page file.

The processor also automatically inserts link tags to translations of the rendered page file.

Developers wanting to use the functionality of this content processor should have a look at the API documentation of Webgen::ContentProcessor::HtmlHead.