Render a TYPO3 content element in a Fluid template

Sometimes it is useful to include a content element directly into a Fluid template. This can be the case if content is to be maintained by editors but is part of the website layout.

First, the following TypoScript snippet is added:

lib.renderContent = RECORDS
lib.renderContent {
    tables = tt_content
    source.field = contentUid
    dontCheckPid = 1

In a Fluid template it can then be invoked via the <f:cObject> view helper:

<!-- 42 is the ID of the content element -->
<f:cObject typoscriptObjectPath="lib.renderContent" data="{contentUid: 42}"/>