I installed SeoBundle and configured the bundle to build a sitemap (docs).
AppKernel.php:
new Sonata\SeoBundle\SonataSeoBundle(),
new Symfony\Cmf\Bundle\CoreBundle\CmfCoreBundle(),
new Symfony\Cmf\Bundle\SeoBundle\CmfSeoBundle(),
Full bundle configurations (config.yml):
sonata_seo:
page:
title: Erasmus internship – Training Experience
metas:
name:
keywords: Erasmus Internships, Internship in Europe, International Internships, Erasmus+, Erasmus Entrepreneur, Student Internships, Internships Abroad, Student Placements
description: Find Internships with Training Experience: Students can find internships & employment opportunities in Europe’s platform for internships. Search paid internships and placements abroad.
viewport: width=device-width, initial-scale=1
format-detection: telephone=no
robots: index, follow
property:
'og:site_name': Training Experience
'og:title': Erasmus internship – Training Experience
'og:description': Find Internships with Training Experience: Students can find internships & employment opportunities in Europe’s platform for internships. Search paid internships and placements abroad."
'og:url': https://www.trainingexperience.org
'og:image': https://www.trainingexperience.org/bundles/index/images/tx-orange.png
http-equiv:
'Content-Type': text/html; charset=utf-8
head:
'xmlns': http://www.w3.org/1999/xhtml
'xmlns:og': http://opengraphprotocol.org/schema/
cmf_seo:
title: seo.title
description: seo.description
sitemap:
enabled: true
content_listener:
enabled: false
Added routes to routing.yml:
sitemaps:
prefix: /sitemaps
resource: "@CmfSeoBundle/Resources/config/routing/sitemap.xml"
Now when I access /sitemaps/sitemap.xml it is opened, but no urls are listed:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"></urlset>
What could I be missing?
Important for the items on sitemat is, that they got a matching (allowed, and sitemap name) as a content. Mostly the content isn't loaded. To do so your Content have to implement
\Symfony\Cmf\Bundle\SeoBundle\SitemapAwareInterface, which forces you to implement and fill a flag. You can find an example in the tests:SitemapAwareContent:you will also see that implementing the interface isn't the only task, you have to set the doctrine mapping also. Doing so, the default loader will fetch you documents and see them (they are visible now). But you can implement your own loader, voter (another decission item to select) and guesser (to fill in extra data) on your own. So you can decide which content is visible on which (you can have several) sitemap.
The documentation currently shows the process for the loaders, voter and guessers only, so we should insert some hints for the default visibility flag and the default usage at all. So i created an issue. It would be nice to get some feedback there, too.