Introduction
The content_slug extension was developed for use with Fluid Styled Content. You could already use it with the Bootstrap Package, although a problem could occur in a specific scenario (see below).
The new version simplifies the use of human-readable fragments with any template solution, including Content Blocks.
Good to know: lib.contentElement
lib.contentElement is the basic configuration for content elements since the introduction of Fluid Styled Content (TYPO3 v7). This TypoScript identifier is also used by the new Camino theme (TYPO3 v14) and the Bootstrap Package. Content blocks (since TYPO3 v13), by contrast, are based on lib.contentBlock.
The content_slug extension adds the fragmentIdentifier variable to lib.contentElement for the human-readable fragment, which is then available in Fluid templates for content elements.
Three new Site Sets
The new version of the extension now makes it easier to use content element templates other than Fluid Styled Content.
There are three Site Sets for different use cases:
- Speaking URL fragments (Basic configuration)
- Speaking URL fragments (for Fluid Styled Content)
- Speaking URL fragments (for Content Blocks)
These configurations are also available as classic TypoScript Sets (Include static).
The extension documentation provides a concise overview of the three sets and their intended purpose.
Below, I will provide some background information and explain why extended Fluid templates are (or can be) provided only for Fluid Styled Content. For other templates, the documentation explains the necessary adjustments.
Fluid Styled Content (FSC)
The extension was originally developed to support these content element templates. In addition to the basic configuration, EXT:content_slug also provides adjusted, ready-to-use Fluid templates for headers as well as the two “Section Index” menus.
Recommended set: "Speaking URL fragments (for Fluid Styled Content)"
Content Blocks
Since everyone creates content elements based on Content Blocks individually, there are no standards for the template structure.
Therefore, only the basic configuration is loaded and then referenced in lib.contentBlock.
To add the two fragment-related fields to your Content Blocks, the extension now includes the predefined Basic (mixin) ContentSlug/Header, which you can either add directly or use as a template.
Recommended set: "Speaking URL fragments (for Content Blocks)"
Bootstrap Package
The Bootstrap Package should not be used in conjunction with Fluid Styled Content. However, the basic structure of the Fluid templates for content elements is largely the same as FSC. This also applies to the header partials: In the Bootstrap Package, headings are (as of today) only assigned additional classes.
The human-readable anchors could already be used in the Bootstrap package in previous versions, with one exception: If you were using site sets and FSC also existed in the TYPO3 installation (possibly for a different site), the former site set sebkln/content-slug would load FSC as a dependency. Its TypoScript would then cause front-end rendering issues.
Because the Bootstrap Package is a third-party extension whose functionality may change at any time, I do not include any ready-made template overrides. However, because it's so similar to FSC, you can easily replicate the necessary changes in Fluid.
Recommended set: "Speaking URL fragments (Basic configuration)"
Camino
The new Camino theme in TYPO3 v14 provided the impulse to add new site sets to EXT:content_slug. However, I eventually decided against directly supporting Camino for two reasons:
- Its template structure would require overwriting at least six Fluid templates and adding the variable {fragmentIdentifier} to them
- As the Camino theme does not provide “Section Index” content elements, anchor links are limited to link fields and the RTE
Therefore, the extension does not include any extended templates for Camino. However, you can adapt them yourself if needed.
Recommended set: "Speaking URL fragments (Basic configuration)"
Custom template solutions
Some developers and agencies have not used Fluid Styled Content for years and instead rely solely on custom content element rendering.
Anyone who does not use lib.contentElement as the basis for their content elements must reference this TypoScript identifier in their custom configuration.
Recommended set: "Speaking URL fragments (Basic configuration)"
Modernized documentation
I have completely reworked the extension documentation. In addition to the technical adjustments needed because of changes to the rendering on docs.typo3.org, I revised the wording in many places and restructured the content.
Request object in ModifyPageLinkConfigurationEvent
With TYPO3 versions 13.4.33 and 14.3.5, the current request was added to ModifyPageLinkConfigurationEvent. I use this event in the ModifyFragment listener to replace the fragment in RTE links and TCA fields of type link.
As a result, I can now retrieve the necessary TypoScript setup directly from the request object. I have also extended the check for a valid frontend request before processing the fragment.
The request is now also passed to the ContentObjectRenderer. This could prevent potential Solr indexing issues, although I haven't been able to reproduce this in any of my installations.
The TYPO3 versions listed above are therefore the new minimum requirements. TYPO3 v12 is no longer supported by the extension.