Bug #86598


TypoScript for fieldToParameterMap does not work (wrong assignment Key => Value)

Added by Kay Röseler over 5 years ago. Updated over 5 years ago.

Must have
Target version:
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


Hello Core Team,

For the current news extension (7.0.6 for TYPO3 9.5) we wanted to include the corresponding news records in the new SEO sitemap. Here I came across a bug that prevents the generated links in the news sitemap from working correctly. Namely, a defined parameter in the TypoScript is not determined correctly and therefore not included in the generated link.

This is the corresponding TypoScript:

config {
    xmlSitemap {
        sitemaps {
            # News (Newsmitteilungen)
            news {
                provider = TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider
                config {
                    table = tx_news_domain_model_news
                    sortField = sorting
                    lastModifiedField = tstamp
                    #additionalWhere = AND (no_index = 0 OR no_follow = 0)
                    pid = 30
                    url {
                        pageId = 31
                        fieldToParameterMap {
                            uid = tx_news_pi1[news]

                        additionalGetParameters {
                            tx_news_pi1.controller = News
                            tx_news_pi1.action = detail

                        useCacheHash = 1

The problem here is the configuration for "fieldToParameterMap". Here, the current Uid of the news record should be linked to the corresponding news parameter. Unfortunately, this does not work.

After some debugging in the core code, I also came across the problem. In the file sysext/seo/Classes/XmlSitemap/RecordsXmlSitemapDataProvider.php the assignment between url part and field name is made in line 136. And this is exactly where a design mistake lies. In lines 87-92 in the same file, all news records (or any other extension, depending on the configuration of the sitemap) are determined and passed to an items array. In this case, the individual data records in this item array are assigned to the subarray 'data'. So far so good.

In the file sysext/seo/Classes/XmlSitemap/AbstractXmlSitemapDataProvider.php the function "defineUrl" is now called in line 136 and given to it the item array determined in the first file as parameter "$data". In the function, the actually problematic function "getUrlFieldParameterMap" is called with this same data array. If you debug this array in the function, you get the following content:

    [data] => Array
            [uid] => 1
            [pid] => 30

    [lastMod] => 1538984469

The function then tries to merge the url part "tx_news_pi1 [news]" with the field "uid" from the data array in the assignment in line 136 in my example.

foreach ($this->config['url']['fieldToParameterMap'] as $field => $urlPart) {
    $additionalParams[$urlPart] = $data[$field];

And that can not work at this point, because as the debug of the data array shows, the actual data (including the uid) can only be found in the subarray "data".

This can be fixed in the file sysext/seo/Classes/XmlSitemap/RecordsXmlSitemapDataProvider.php in line 104, in which not the complete data array is transferred, but only the subarray "data":


$additionalParams = $this->getUrlFieldParameterMap($additionalParams, $data);


$additionalParams = $this->getUrlFieldParameterMap($additionalParams, $data['data']);

I hope my long explanation helps. ;-)

Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #86602: Ext: seo sitemap for records brokenClosedSusanne Moog2018-10-09

Actions #1

Updated by Georg Ringer over 5 years ago

  • Status changed from New to Closed

closed as a duplicate of #86602. patch is already pending

thanks however for the detailed issue!

Actions #2

Updated by Georg Ringer over 5 years ago

  • Is duplicate of Bug #86602: Ext: seo sitemap for records broken added

Also available in: Atom PDF