首页 > 解决方案 > Typo3:覆盖元标记(tx_news)

问题描述

我目前正在为我的网页进行 SEO。因此,我想从当前在浏览器中打开的新闻文章中获取 page.meta.author/title/description...。如果没有设置,它应该回退到常量中配置的默认值。

我正在做类似的事情:

page.meta {
   author < plugin.tx_news.currentNewsItem.author // I don't know what to write here
   author.ifEmpty = {$page.meta.author}
}

另外我不确定以下代码的作用:

page.meta {
   author {
      override.field = author
   }
}

我感谢所有的帮助。

标签: typo3typoscripttx-news

解决方案


正如@Ghanshyam Bhava 在评论中建议的那样,我在我的设置打字稿中使用了这个:

[globalVar = GP:tx_news_pi1|news > 0]
    page {
        config {
            noPageTitle = 0
        }
        headerData {
            776 >
        }
        meta {
            description >
            author >
            keywords >
        }
    }
[end]

我只需要修改 headerdata 编号,因为我使用的是 SEO_Basics 扩展,而且我还必须确保扩展的层次结构在模板中是正确的。

对于页面元标记,只要不满足上述条件,我就使用常量排版中定义的默认值。


推荐阅读