【问题标题】:TYPO3 News Sitemap Configuration - actual date in additionalWhere statementTYPO3 新闻站点地图配置 - AdditionalWhere 语句中的实际日期
【发布时间】:2021-12-29 18:28:04
【问题描述】:

带有 seo 和新闻扩展的 TYPO3 V10:

在我的新闻站点地图中,我只想显示未归档的新闻。以下配置有效,但我需要将时间戳的固定值替换为动态值:

plugin.tx_seo.config {
    xmlSitemap {
        sitemaps {
            news {
                provider = TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider
                config {
                    table = tx_news_domain_model_news
                    additionalWhere = AND archive = 0 OR archive > 1640800495

我该怎么做?

我知道如何在 TypoScript 中将语句构建为文本对象,但如何在 additonalWhere 后面使用它:

lib.statement = TEXT
lib.statement.value = AND archive = 0 OR archive > {date : U}
lib.statement.value.insertData = 1

我知道如何使用常量,但我认为我无法使其动态化:

additionalWhere = {$constant.statement}

我也尝试使用 REGISTER,但没有成功。

additionalWhere = AND archive = 0 OR archive > {REGISTER:statement}
additionalWhere.insertData = 1

【问题讨论】:

  • 我会尝试通过SQL设置约束...不需要通过TS设置固定时间戳。
  • 感谢这个伟大而简单的想法。

标签: typo3 seo typoscript typo3-extensions


【解决方案1】:

我认为,这里直接使用 SQL 函数是最好的解决方案(感谢 Julian Hofmann):

additionalWhere = start_date > CURDATE()

additionalWhere = archive = 0 OR archive > UNIX_TIMESTAMP()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多