Skip to content
OpenCms documentation
OpenCms documentation

Unused contents app

The Unused contents app is a utility tool to search for and delete contents that are no longer used.

Screenshot of the Unused contents app

The user interface of the Unused contents app is divided into a left pane and a right pane. The left pane contains options to search for unused contents with various filter form fields. The right pane displays the found contents in an interactive table.

A content—e.g. a content section or a link sequence—is considered "unused" if it is not shown on any container page and is not linked by any other content.

The app checks the use of a content both in the offline project and in the online project. For a content to be considered unused, it must not be linked in any of these projects.

There are content elements that are not used directly on container pages but are displayed indirectly with lists, e.g. the article. Such content is always considered as "used content" and is therefore not handled by the app.

The app can be opened in two ways:

  1. Via the launchpad
  2. Via the explorer's context menu on folders, clicking the menu entry Advanced > Delete unused contents

The left pane provides a set of filter options for an unused content search:

Site. The select box defines the site to search for unused contents.

Search folder. This can be used to restrict the search to a subfolder of the previously selected site.

Resource type. The select box restricts the search to a specific resource type. If no resource type is selected, all types are searched.

In the upper-right corner of the right panel, there is an additional filter field for the result table:

Filter. The filter field in the upper right-hand corner can be used to filter the result table columns Path, Title, Type and Type (internal).

There are two ways to delete contents:

  1. With the button Delete all in the left pane. The button first selects all contents from the result table, taking into account the search and filter options selected as described above. After that, a delete dialog appears in which the selected contents to be deleted are listed again. By pressing the delete button of the dialog, the contents are deleted.
  2. Individual contents can also be deleted via the context menu of the result table. The context menu opens when clicking on the resource icon in the first column of the result table.

In order to exclude single contents to be identified as "unused content", one can set the property NavInfo to the value keep. If set in this way, a content does not appear in the result table any more.

To make the entry disappear from the list after you have set this property, click the Search button on the left pane. Be sure to do this before you click the Delete all button, since this button selects all contents that are currently displayed in the list.

For technical reasons, a search for unused contents cannot be performed in the root folders /, /sites/, /shared/ and /system/.

Which content types are handled by the app and which not can be controlled via the XML schema of a content type.

If the search setting containerPageOnly="true" is defined in an XML schema, the content type is taken into account. If the search setting does not exist at all or if the value of the containerPageOnly attribute is set to false, all contents of that type are ignored when searching for unused contents.

<searchsettings containerPageOnly="true" />

The search setting containerPageOnly="true" means that contents should only be searched as part of a container page, not as individual contents. In this way, the search setting marks exactly those content types that are linked on container pages and thus can be "unused".

It can be useful to include or exclude singular content types from the unused content search contrary to this search setting. For this purpose, an XML schema parameter named unusedcontentfinder can be assigned with the values include or exlcude.

<xsd:appinfo>
    <parameters>
        <param name="unusedcontentfinder">include</param>
        <param name="unusedcontentfinder">exclude</param>
    </parameters>
</xsd:appinfo>
 
The parameter has stronger effect than the search setting.