"Fossies" - the Fresh Open Source Software Archive

Member "incubator-pagespeed-mod-1.14.36.1/html/doc/filter-head-add.html" (28 Feb 2020, 2465 Bytes) of package /linux/www/apache_httpd_modules/incubator-pagespeed-mod-1.14.36.1.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the incubator-pagespeed-mod-1.14.36.1.tar.gz project site itself.

Add Head

Configuration

The 'Add Head' filter is enabled by specifying:

Apache:
ModPagespeedEnableFilters add_head
Nginx:
pagespeed EnableFilters add_head;

in the configuration file, but it is also enabled automatically by several other filters, including combine_heads, move_css_to_head, and add_instrumentation.

Description

The 'Add Head' filter is very simple: it adds a head to the document if it encounters a <body> tag before finding a <head> tag.

For example, if the HTML document looks like this:

<html>
  <body>
    <div class="blue yellow big bold">
      Hello, world!
    </div>
  </body>
</html>

Then PageSpeed will rewrite it into:

<html>
  <head>
  </head>
  <body>
    <div class="blue yellow big bold">
      Hello, world!
    </div>
  </body>
</html>

Note

This filter exists primarily to ensure that other filters have a place to insert new tags that needs to be in the head, or that trigger on the closing-tag for a head to perform some other action.

Risks

This filter is considered minimal risk.