Issue Bug Closed

#93010EXT:seo sitemap includes none published pages from workspaces

Daniel Siepmann 12/07/20, 09:22 updated 02/23/21, 13:13

Description

Steps to reproduce:
  1. Switch to a workspace
  2. Create a new page
  3. Enable page within workspace (remove hidden)
  4. Open the custom sitemap in incognito mode (to prevent Workspace preview)
  5. You should see the new page.

Expected 5. step:
You should not see the new page, as it only should exist within the workspace.

The RecordsXmlSitemapDataProvider seem to be affected.
Entries are rendered twice when in workspace preview. I guess that’s caused by the underlying issue and will be fixed all together.

I already tried to figure out what happens, but have not enough knowledge. But I think the page is created twice, once within the workspace, and once outsite. So EXT:seo needs to add some more checks?

PagesXmlSitemapDataProvider is not affected, as it uses $cObj->getTreeList to determine page uids, which already respects workspaces.

The corresponding TypoScript:

plugin.tx_seo {
    config {
        xmlSitemap {
            sitemaps {
                rssFeedAllBlogPosts {
                    provider = TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider
                    config {
                        table = pages
                        sortField = lastUpdated
                        lastModifiedField = tstamp
                        additionalWhere = {$plugin.tx_seo.settings.xmlSitemap.sitemaps.pages.additionalWhere}
                        pid = 3
                        recursive = 1
                        template = RssFeed
                    }
                }
            }
        }
    }
}

And template:

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Daniel Siepmann - Coding is Art</title>
        <description>List of blog posts at daniel-siepmann.de</description>
        <link>{f:uri.page(pageUid: 1, absolute: 1)}</link>
        <atom:link href="{f:uri.page(pageUid: 1. pageType: 1533906435, additionalParams: {sitemap: 'rssFeedAllBlogPosts'}, absolute: 1)}" rel="self" type="application/rss+xml" />
        <lastBuildDate>{f:format.date(date: 'now', format: 'D, d M Y H:i:s O')}</lastBuildDate>
        <ttl>1800</ttl>

        <f:for each="{items}" as="item">
            <f:if condition="{item.data.doktype} < 200">
                {f:render(section: 'Item', arguments: {
                    item: item.data
                })}
            </f:if>
        </f:for>
    </channel>
</rss>

<f:section name="Item">
    <item>
        <title>{item.title}</title>
        <description>{item.abstract}</description>
        <link>{f:uri.page(pageUid: item.uid, absolute: 1)}</link>
        <pubDate>{f:format.date(date: item.lastUpdated, format: 'D, d M Y H:i:s O')}</pubDate>
        <guid isPermaLink="true">{f:uri.page(pageUid: item.uid, absolute: 1)}</guid>
    </item>
</f:section>

I know the feature is not intended for RSS Feeds. I didn’t try with other record types beside pages.

I guess I’ll create my own provider for RSS Feed, in case someone else also got the same issues, we might think about fixing this issue.

Reviews 2