TypoScript Setup
Configure prefix and suffix
Any configuration needs to be prefixed with
plugin.
| Name | Type | Default |
|---|---|---|
| Content Objects (cObject) | TEXT cObject with current UID | |
| Content Objects (cObject) | TEXT cObject with current UID | |
| boolean | 1 | |
| boolean | 1 |
urlFragmentPrefix
-
- Type
- Content Objects (cObject)
- Default
- TEXT cObject with current UID
This cObject can be used to render a prefix for the human-readable URL fragment.
Prefix, suffix, and fragment are assembled in the custom variable fragmentIdentifier of
lib.contentElement.Note
The prefix is enabled by default with the corresponding Site setting (or TypoScript constant).
Default:
plugin.tx_contentslug.urlFragmentPrefix = TEXT plugin.tx_contentslug.urlFragmentPrefix { field = uid stdWrap.noTrimWrap = |c|-| if.isTrue = {$plugin.tx_contentslug.settings.renderPrefix} }Copied!Result:
c<uid>-<human-readable-fragment> c123-section-of-interestCopied!
urlFragmentSuffix
-
- Type
- Content Objects (cObject)
- Default
- TEXT cObject with current UID
This cObject can be used to render a suffix for the human-readable URL fragment.
Prefix, suffix, and fragment are assembled in the custom variable fragmentIdentifier of
lib.contentElement.Note
The suffix is disabled by default with the corresponding Site setting (or TypoScript constant).
Default:
plugin.tx_contentslug.urlFragmentSuffix = TEXT plugin.tx_contentslug.urlFragmentSuffix { field = uid stdWrap.noTrimWrap = |-|| if.isTrue = {$plugin.tx_contentslug.settings.renderSuffix} }Copied!Result (if activated):
<human-readable-fragment>-<uid> section-of-interest-123Copied!
replaceFragmentInPageLinks
-
- Type
- boolean
- Default
- 1
When activated, fragment links set in the RTE or in TCA fields of type
linkare replaced with the human-readable fragment identifier.
Assemble the
fragmentIdentifier
variable
This variable will be available in every content element template and allows to configure the complete URL fragment at a central place.
Attention
This variable is also processed in the following classes:
- The custom DataProcessor
Fragment, which will process the URL fragments for the "Section Index" content elements.Identifier Processor - The
Modifyevent listener, which allows to overwrite fragments for links set in the rich text editor or in TCA fields of typeFragment link.
lib.contentElement {
variables {
// Build a complete fragment identifier with possible prefix and suffix:
fragmentIdentifier = COA
fragmentIdentifier {
if.isTrue.field = tx_content_slug_fragment
10 =< plugin.tx_contentslug.urlFragmentPrefix
20 = TEXT
20.field = tx_content_slug_fragment
30 =< plugin.tx_contentslug.urlFragmentSuffix
stdWrap.trim = 1
}
}
}
Sanitize custom data with
postUserFunc
In case you append or prepend some custom strings, you can use the fragment evaluation to sanitize the completed URL fragment again:
urlFragmentSuffix = TEXT
urlFragmentSuffix {
field = subheader
if.isTrue.field = subheader
stdWrap.noTrimWrap = |-||
}
lib.contentElement.variables.fragmentIdentifier {
stdWrap.postUserFunc = Sebkln\ContentSlug\Evaluation\FragmentEvaluation->sanitizeFragment
}