FluidTYPO3 / vhs

TYPO3 extension VHS: Fluid ViewHelpers
https://fluidtypo3.org
Other
189 stars 228 forks source link

LanguageMenuViewHelper can trigger a caching problem with URL parameters #1805

Closed ako-3004 closed 1 year ago

ako-3004 commented 2 years ago

vhs 6.1.2 / TYPO3 10.4.32

Situation:

Could replicate this on different webs with different VHS and TYPO3 versions. Cause here is the 'addQueryString' => 1 in getLanguageUrl() in ViewHelper.

I wouldn't consider this a bug but an additional difficulty in dealing with the LanguageMenuViewHelper.

I see possible workarounds:

  1. the LanguageMenuViewHelper must be called from an uncached plugin.
  2. the addQueryString should be set to 0, but then necessary URL parameters from the system must be explicitly allowed.
NamelessCoder commented 1 year ago

You are supposed to use the excludeQueryVars argument on the ViewHelper to list the arguments you do NOT want to append to the URL of each language option. By default, the arguments id,L,cHash are excluded.

See also the section "Excluding GET Parameters from Page Variants" on https://b13.com/blog/caching-in-typo3-part-2-cache-variants-of-a-page-with-chash. You may want to assign the value of $TYPO3_CONF_VARS[FE][cacheHash][excludedParameters] to your template and use this as value of the excludeQueryVars argument for v:languageMenu (this option is designed precisely for various utm_* and similar types of URL parameters).