Search code examples
typo3seotyposcripttypo3-extensions

TYPO3 News Sitemap Configuration - actual date in additionalWhere statement


TYPO3 V10 with seo and news extension:

In my news sitemap I only want to show news that are not archived. The following configuration works, but I need to replace the fixed value for the timestamp with a dynamic one:

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

How can I do this?

I know how to build the statement as a text object in TypoScript, but how can I use it behind additonalWhere:

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

I know how to use a constant, but I think I can't make it dynamic:

additionalWhere = {$constant.statement}

I also tried to use a REGISTER, but without success.

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

Solution

  • I think, using a SQL Function directly is the best solution here (thanks to Julian Hofmann):

    additionalWhere = start_date > CURDATE()
    

    or

    additionalWhere = archive = 0 OR archive > UNIX_TIMESTAMP()