tx_news n:link 不想用 config.absPrefix 构建绝对 link
tx_news n:link don't want build absolute link with config.absPrefix
在 tx_news 模板中我们有 <n:link
跟随 <f:link.typolink
似乎我们可以使用 configuration="{forceAbsoluteUrl: 1}"
和 get
<h3>
<n:link configuration="{forceAbsoluteUrl: 1}" newsItem="{newsItem}" settings="{settings}" title="{newsItem.title}">
<span itemprop="headline">{newsItem.title}</span>
</n:link>
</h3>
对于构建绝对 link TYPO3 使用 config.absPrefix
但在 TYPO3 9.5.3 中无效。我可以在站点 Configuration -> Entry Point
中更改此设置。但不是更多的打字。
我查过了。这个 typoscript 设置在 TYPO3 9.5.3 中仍然可用。但是看起来只为资产工作(header 中的 scripts/styles)不再为 link 工作?我可以解决这个问题吗?
最后我需要 tx_news 中的绝对 links 来自 config.absPrefix
或其他拼写错误但不是 config.yaml
尝试使用 config.absRefPrefix
而不是 config.absPrefix
在 TYPO3 v9 中,没有任何一种来自 typoscript 的解决方案不起作用。5.x 所以我必须使用 Site manager Variants
rootPageId: 1
base: www.livedomain.com
baseVariants:
-
base: 'http://localhost'
condition: 'applicationContext == "Development"'
-
base: 'https://stagedomain.com'
condition: 'applicationContext == "Testing"'
在我的 apache2 或 .htaccess 中
SetEnv TYPO3_CONTEXT Development
或
SetEnv TYPO3_CONTEXT Testing
如果未设置上下文,网站使用 base url 在其他情况下来自 baseVariants
在 tx_news 模板中我们有 <n:link
跟随 <f:link.typolink
似乎我们可以使用 configuration="{forceAbsoluteUrl: 1}"
和 get
<h3>
<n:link configuration="{forceAbsoluteUrl: 1}" newsItem="{newsItem}" settings="{settings}" title="{newsItem.title}">
<span itemprop="headline">{newsItem.title}</span>
</n:link>
</h3>
对于构建绝对 link TYPO3 使用 config.absPrefix
但在 TYPO3 9.5.3 中无效。我可以在站点 Configuration -> Entry Point
中更改此设置。但不是更多的打字。
我查过了。这个 typoscript 设置在 TYPO3 9.5.3 中仍然可用。但是看起来只为资产工作(header 中的 scripts/styles)不再为 link 工作?我可以解决这个问题吗?
最后我需要 tx_news 中的绝对 links 来自 config.absPrefix
或其他拼写错误但不是 config.yaml
尝试使用 config.absRefPrefix
而不是 config.absPrefix
在 TYPO3 v9 中,没有任何一种来自 typoscript 的解决方案不起作用。5.x 所以我必须使用 Site manager Variants
rootPageId: 1
base: www.livedomain.com
baseVariants:
-
base: 'http://localhost'
condition: 'applicationContext == "Development"'
-
base: 'https://stagedomain.com'
condition: 'applicationContext == "Testing"'
在我的 apache2 或 .htaccess 中
SetEnv TYPO3_CONTEXT Development
或
SetEnv TYPO3_CONTEXT Testing
如果未设置上下文,网站使用 base url 在其他情况下来自 baseVariants