Extend sitemap
Permalink
Within the current generated sitemap, I would like to add some more entries using the following line of code:
echo file_get_contents('http://voorraad.yoursite.nl/sitemap.xml?include=true');
I can't figure out where to add this in jobs/generate_sitemap.php
The output needs to be within <urlset></urlset>
echo file_get_contents('http://voorraad.yoursite.nl/sitemap.xml?include=true');
I can't figure out where to add this in jobs/generate_sitemap.php
The output needs to be within <urlset></urlset>
This post saved me a lot of time, thank you. My solution was:
Inside
Added this code:
Inside
application/boostrap/app.php
Added this code:
Events::addListener('on_sitemap_xml_ready', function($event) { $sitemap = $event->getSubject()['xmlDoc']; // put your additional sitemap.xml URLs below $url = $sitemap->addChild('url'); $url->addChild('loc', BASE_URL . '/woot'); $url->addChild('lastmod', date('Y-m-d\TH:i:sP', time())); $url->addChild('changefreq', 'monthly'); $url->addChild('priority', '0.5'); });
Nice!
If you have time, this might make a great tutorial:https://documentation.concrete5.org/tutorials...
If you have time, this might make a great tutorial:https://documentation.concrete5.org/tutorials...
Here's some documentation on how to hook into events (although not this particular event):
http://documentation.concrete5.org/developers/application-events/ho...
Within that event, you should get the full XML document as a Simlple XML element that you can modify prior to that XML being saved to a file.