This is a simple project to build a valid sitemap.xml string from the files in the documentation repository.
This project was created for a couple of reasons. Firstly, to generate a valid sitemap.xml file for the documentation, and then to keep it up to date. Maintaining software documentation isn't that simple. And getting the right information (meaning the most up to date information) to appear in search results requires a valid and well-constructed sitemap.xml file. To create and maintain one by hand for a project of this size isn't practical. So this library was created to automate the process, whether once or with each merge to master.
To install the package, run composer require settermjd/owncloud-documentation-sitemap-builder
.
Below is a sample of how to use the package.
It shows how to instantiate a new SitemapBuilder
instance, which is constructed with the default ownCloud basePath and version settings.
On this instance:
- A call to
getSitemapUrlList
is made. This converts the.rst
files found under../documentation
into a set of equivalent URLs. - The generated URLs list is then passed to
generateSiteMapXml
, which builds a sitemap.xml string from the supplied information.
<?php
require_once ('vendor/autoload.php');
$builder = new OwnCloud\SiteMapBuilder\SitemapBuilder();
$builder->generateSiteMapXml(
$builder->getSitemapUrlList(
realpath('../documentation/'),
'rst'
)
);
See the CONTRIBUTING file.