The BootPress Sitemap Component generates the sitemap[...].xml files by saving all of your website's links, and keeping track of any updates. Any 404 pages are removed as they come to our attention (via $page->send(404)
). It also has convenience methods for adding or removing multiple pages at once, and searching the entire site or any parts thereof. The only heads up is to watch what you Sitemap::add()
to the database. Listing or product pages that have constantly changing or updated content are not good candidates for the sitemap. It will screw up your searches, and you only want Google to index real content pages anyways.
Add the following to your composer.json
file.
{
"require": {
"bootpress/sitemap": "^1.0"
}
}
<?php
use BootPress\Page\Component as Page;
use BootPress\Sitemap\Component as Sitemap;
$page = Page::html();
if ($xml = Sitemap::page()) {
$page->send($xml);
}
$html = '<p>Content</p>';
Sitemap::add('pages', $html);
$page->send($page->display($html));
The MIT License (MIT). Please see License File for more information.