To render Google compliant news sitemap with TYPO3 version 9.5 with its included SEO extension and thirdparty news extension from Georg Ringer, this example is a quick start you can embed in your own project.
It follows the recommended XML scheme from Google Google News Sitemaps
You need to use a project or sitepackage extension in your TYPO3 installation (see also Sitepackage builder).
Given, you already have installed TYPO3 9 system extension seo and included static TypoScript for it...
You need to embed following two files in your project or sitepackage extension:
- TxNewsGoogleXmlSitemapDataProvider.php - PHP class as data provider for news XML sitemap /Classes/XmlSitemap/TxNewsGoogleXmlSitemapDataProvider.php
- GoogleNews.xml - FLUID template for news sitemap /Resources/Private/Templates/XmlSitemap/GoogleNews.xml
Include TypoScript setup.typoscript in your setup to use provider class and FLUID template for rendering.
- Adjust PHP namespace definitions for vendor and sitepackage in TxNewsGoogleXmlSitemapDataProvider.php compared to your project or sitepackage extension (Vendor\Sitepackage)
- Adjust TypoScript and specify at least provider class, pid and pageId in TypoScript compared to your page ID's in your installation:
- plugin.tx_seo.config.xmlSitemap.sitemaps.TxNewsGoogle.provider = Vendor\Sitepackage\XmlSitemap\TxNewsGoogleXmlSitemapDataProvider
- plugin.tx_seo.config.xmlSitemap.sitemaps.TxNewsGoogle.config.pid ... storage page for News
- plugin.tx_seo.config.xmlSitemap.sitemaps.TxNewsGoogle.config.url.pageId ... detail view page for News
- See also API/XML Sitemap
You are free to use and adopt this solution. Hints are appreciated. Improvements will help other projects. Leave a comment or link - maybe our contribution will be embed in news extension in future.
Hi,
what is then, the url to access to the news sitemap?
I have done all the process of your tuto, but can't see any additionnal site map in the TYPO3 XML Sitemap index.
Thanks.