Nov 9, 2021 3:30:26 PM Thomas Dumont avatar



PageIncludeServices are services that allow you to include HTML code in the pages of the site through bookmarks placed in the main template of the portal (page_frameset.html).
These services can introduce content but are rather intended insert technical code in non-accessible locations for portlets or the XPageApp. For example insert dynamically, in the part <head> HTML pages, links to CSS style sheets or to RSS files.

Core's PageIncludeServices

Lutece integrates by default several PageIncludeServices :

Name Description
Links Inserting CSS Style Sheets and Specific Javascripts for Installed Plugins
Metas Insert meta tag values ​​from those defined in the file
Themes Dynamic management of CSS style sheet paths according to the theme associated with the page
Statistics Insert the HTML code specific to the audience measurement tool

The default services are declared in the file

Creating a PageIncludeService


Plugins can add new PageIncludeServices by declaring them in their XML file as follows:

<!-- Page Includes -->
        <page-include-service-name>My Include Service</page-include-service-name>


A PageIncludeService must implement the PageInclude interface.

Here is a very simple example of implementation:

import java.util.Map;
import javax.servlet.http.HttpServletRequest;

public class MyInclude implements PageInclude
    private static final String MARK_MY_INCLUDE = "my_include";

    * {@inheritDoc}
    public void fillTemplate( Map<String, Object> rootModel, PageData data, int nMode, HttpServletRequest request )
        rootModel.put( MARK_MY_INCLUDE, "My include content" );