TYPO3CMS-Reference-CoreApi
TYPO3CMS-Reference-CoreApi copied to clipboard
Add explanation for when cHash is added in routing enhancer section
The below refers to URLs with a limited set of parameters.
... or how to get rid of cHash in the URL.
There are a number of related questions online (e.g. on Stackoverflow, on Forge) and there is some explanation, but some of it is vague and not definitive. It might be a good idea to add the information to the docs
- when a cHash is added to the URL
- how to get rid of the cHash (reqirement, aspect, ...?)
Related docs / information
The requirements section exactly specifies what kind of parameter should be added to that route as regular expression. This way, it is configurable to only allow integer values for e.g. pagination. If the requirements are too loose, a URL signature parameter (“cHash”) is added to the end of the URL which cannot be removed.
https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ApiOverview/Routing/AdvancedRoutingConfiguration.html?highlight=advanced%20routing#simple-enhancer
So what is too loose?
the cHash is also added if the restrictions are too loose or more than (I think) 10000 possibilities are returned.
https://stackoverflow.com/questions/57649210/typo3-routeenhancer-with-custom-valuemapper#comment101766166_57649210
Here, the solution is to implement StaticMappableAspectInterface: https://stackoverflow.com/questions/59643974/typo3-cms-9-lts-cacheable-extbase-action-but-no-chash-with-new-routing
Some solutions use a workaround:
e.g. here:
aspects:
klinik:
type: PersistedAliasMapper
tableName: tx_hplusinfo_domain_model_klinik
routeFieldName: uid
http://typo3.3.n7.nabble.com/routeEnhancers-Extabase-cHash-loswerden-tp292271p292275.html
Is it necessary to do this or would a requirements section work as well?
Links
questions / answers:
- https://stackoverflow.com/questions/57649210/typo3-routeenhancer-with-custom-valuemappe
- http://typo3.3.n7.nabble.com/routeEnhancers-Extabase-cHash-loswerden-td292271.html
- https://forge.typo3.org/issues/90074
- https://stackoverflow.com/questions/59643974/typo3-cms-9-lts-cacheable-extbase-action-but-no-chash-with-new-routing
- http://5.9.10.113/57674403/typo3-routing-and-aspect-remove-chash-from-url
- https://stackoverflow.com/questions/54673762/how-to-get-rid-of-the-chash-with-routing-enhancers