Bug #88847
closedGetting site configuration via TypoScript is not respecting conditions
100%
Description
- Have a site configuration like:
rootPageId: 1 base: 'https://www.website.com/' baseVariants: - base: 'https://remote-dev.website.com/' condition: 'applicationContext == "Development"' - base: 'http://local-dev.website.com/' condition: 'getenv("LOCAL_DEVELOPMENT") == 1'
- Try to add <base href=""> to the website header via
page.headerData.1234 = TEXT page.headerData.1234 { data = site:base wrap = <base href="|"> }
- When visiting https://remote-dev.website.com/, the base-tag will be filled with http://local-dev.website.com/ => Incorrect.
- Reason is, that within the ContentObjectRenderer in the getData method the site configuration is extracted via Array-Path site:baseVariants.0.base.
- It simply takes the first base variant available, not respecting conditions in any way.
- Result is, that all links are broken, as the base-tag is incorrect.
- Getting site configuration in that way should respect the whole configuration including conditions like everywhere else.
- I thought that the SEO-Extension had the same problem with creating the canonical-tag. However, the link there is created differently via generateUri method of the PageRouter.
Current workaround is to put reverse the order of the baseVariants and add additional conditions to check for local development and/or remote development.
Files
Updated by Guido Schmechel over 5 years ago
- File 88847.diff 88847.diff added
Can confirm it for the ContentObjectRenderer.
The problem is that the array is simply read out. In the case of the baseUrl there is the extra array "baseVariants", which is ignored. There is a corresponding function in Site Class.
I apply a simple patch. With these small changes I came to a positive result. I'll push the patch and then we'll see if the way is right.
Btw: I did not notice problems with CanonicalTag.
Updated by Gerrit Code Review over 5 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61375
Updated by Gerrit Code Review over 5 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61375
Updated by Gerrit Code Review over 5 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61375
Updated by Susanne Moog over 5 years ago
- Tags changed from pagerenderer,frontend,base,site,configuration to pagerenderer,frontend,base,site,configuration,CodingNight
Updated by Gerrit Code Review over 5 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61461
Updated by Guido Schmechel over 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset dbd8943fa4aa31743370c72c89ea03e7de223045.
Updated by Gerrit Code Review over 5 years ago
- Status changed from Resolved to Under Review
Patch set 2 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61461
Updated by Guido Schmechel over 5 years ago
- Status changed from Under Review to Resolved
Applied in changeset 8b13eaeda4669d451d54db54cb5aaf8faf0a4c59.
Updated by Benni Mack almost 5 years ago
- Status changed from Resolved to Closed