TYPO3:检查当前页面是否被打字稿翻译 [英] TYPO3: check if current page is translated by typoscript
本文介绍了TYPO3:检查当前页面是否被打字稿翻译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于通过typoscript生成canonical标签,我需要检查当前页面是否被翻译.如果不是,则规范需要指向默认语言的 url.
For the generation of the canonical tag by typoscript, I need to check if the current page is translated. If not, the canonical needs to point to the url in default language.
如何检查当前页面是否被打字稿翻译过?
How can I check if current page is translated by typoscript?
我的排版配置中的语言处理:
Language handling in my typoscript config:
sys_language_overlay = 1
sys_language_mode = content_fallback
推荐答案
如果有人感兴趣,我已经为我的任务制定了一个解决方案:如果当前页面没有翻译,则以默认语言呈现规范 url (content_fallback)
If anyone is interested, I have worked out a solution to my task: Render the canonical url in default language if there is no translation for the current page (content_fallback)
page.headerData.10 = COA
page.headerData.10 {
10 = LOAD_REGISTER
10.isPageTranslated.cObject = CONTENT
10.isPageTranslated.cObject {
table = pages
select {
selectFields = plo.sys_language_uid
pidInList = {$config.rootPid}
join = pages_language_overlay plo ON plo.pid = pages.uid
where = plo.pid = ###pid### AND plo.sys_language_uid = ###lang### AND plo.deleted = 0 AND plo.hidden = 0
markers {
pid.data = page:uid
lang.data = page:sys_language_uid
}
}
renderObj = TEXT
# translation available
renderObj {
wrap = <link rel="canonical" href="|">
typolink {
parameter.data = TSFE:id
returnLast = url
}
append = TEXT
append.value (
)
}
}
20 = TEXT
20 {
data = register:isPageTranslated
ifEmpty {
# no translation available
wrap = <link rel="canonical" href="|">
typolink {
parameter.data = TSFE:id
additionalParams = &L=0
returnLast = url
}
append = TEXT
append.value (
)
}
}
}
这篇关于TYPO3:检查当前页面是否被打字稿翻译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文