TYPO3 - Link 到外部 URL 重定向
TYPO3 - Link to external URL redirect
我正在使用 TYPO3 v6.2,在页脚中我有指向我的社交网络的链接:
如您所见,它是“Link 到外部 URL”。
问题:TYPO3 使用 303 创建新的 URL www.mycompany.com/twitter and then redirects to www.twitter.com/mycompany。如何避免这种行为?
6.2需要自己在菜单中进行即时渲染:
对于类型为 "external URL" (doktype == 3
) 的每个页面,您需要进行特殊处理。
NO {
:
your default configuration
:
// special handling for 'external URL'
doNotLinkIt = 1
doNotLinkIt.if {
equals.field = doktype
value = 3
}
stdWrap.cObject = TEXT
stdWrap.cObject {
if {
equals.field = doktype
value = 3
}
field = navtitle // title
typolink {
parameter.field = url
extTarget.field = target
}
}
}
如果您还想对快捷方式进行特殊处理,您最好将 CASE
对象与 key.field = doktype
一起使用
NO {
:
std handling (wrap)
:
// don't do the std link:
doNotLinkIt = 1
// but link it yourself:
stdWrap.cObject = CASE
stdWrap.cObject {
key.field = doktype
// normal pages:
default = TEXT
default {
field = navtitle // title
typolink.parameter.field = uid
}
// shortcut
4 < .default
4.typolink.parameter.field = shortcut
// external url
3 < .default
3.typolink.parameter.field = url
3.typolink.extTarget.field = target
}
}
TYPO3 7 中的行为已更改:Breaking: #62812 - Resolve URLs to “Link to external URL”-pages directly
The behaviour of pages with the type “Link to External URL” has changed for menus. Those pages link now directly to the provided url instead of linking the internal page with a redirect afterwards.
我想这就是问题的意图。
我正在使用 TYPO3 v6.2,在页脚中我有指向我的社交网络的链接:
如您所见,它是“Link 到外部 URL”。
问题:TYPO3 使用 303 创建新的 URL www.mycompany.com/twitter and then redirects to www.twitter.com/mycompany。如何避免这种行为?
6.2需要自己在菜单中进行即时渲染:
对于类型为 "external URL" (doktype == 3
) 的每个页面,您需要进行特殊处理。
NO {
:
your default configuration
:
// special handling for 'external URL'
doNotLinkIt = 1
doNotLinkIt.if {
equals.field = doktype
value = 3
}
stdWrap.cObject = TEXT
stdWrap.cObject {
if {
equals.field = doktype
value = 3
}
field = navtitle // title
typolink {
parameter.field = url
extTarget.field = target
}
}
}
如果您还想对快捷方式进行特殊处理,您最好将 CASE
对象与 key.field = doktype
NO {
:
std handling (wrap)
:
// don't do the std link:
doNotLinkIt = 1
// but link it yourself:
stdWrap.cObject = CASE
stdWrap.cObject {
key.field = doktype
// normal pages:
default = TEXT
default {
field = navtitle // title
typolink.parameter.field = uid
}
// shortcut
4 < .default
4.typolink.parameter.field = shortcut
// external url
3 < .default
3.typolink.parameter.field = url
3.typolink.extTarget.field = target
}
}
TYPO3 7 中的行为已更改:Breaking: #62812 - Resolve URLs to “Link to external URL”-pages directly
The behaviour of pages with the type “Link to External URL” has changed for menus. Those pages link now directly to the provided url instead of linking the internal page with a redirect afterwards.
我想这就是问题的意图。