1

In TYPO3 with the seo extension it is fairly easy to provide google site maps for pages and records: simply use XmlSitemapDataProviders. No problem to use it for tx_news when you only use a few detail pages.

But i can`t figure out how to build the sitemaps when the detail pages are defined in the categories: every news should be displayed on the detail page which is defined in the first news category.

I am able to write my own XmlSitemapDataProvider but that is not enough: the problem is in the XmlSitemapRenderer. He generates the sitemaps (with there individual XmlSitemapDataProviders) depending on the config array:

sitemaps {
    pages {}
    news1 {}
    news2 {}

and so on. My idea is, that there should be an entry for every category with a defined detail page.

How can i accomplish this? Thanks!

lisardo
  • 1,322
  • 16
  • 31

1 Answers1

1

You should be able to create just 1 XmlSitemapDataProvider. Within that generator you can do whatever you want. If you extend your dataprovider from the AbstractXmlSitemapDataProvider, the main thing you have to take care of is the defineUrl method. In the RecordsXmlSitemapDataProvider you can see an example of that method.

In that method you get the data from of the record. Based on that information you can get the information from the categories and define your page id of your detail page.

If needed, I can try to make some sort of example later this week. Might be an interesting topic for a new blogpost ;-)

Kind regards,

Richard Haeser - TYPO3 SEO Initiative

  • Good advice, thanks. In the end i combined this solution with the already existing sitemap skript of tx_news. It is written for a special sitemap extension which does not work on TYPO3 9.5 but i found the bits and pieces for a category driven sitemap. With little adaptaion i could use it in my new XmlSitemapDataProvider. – lisardo Apr 27 '19 at 19:43
  • 1
    An example would be useful to people that use news extension with Typo3. Thanks in advance! – olegsv May 29 '19 at 17:24