1. Go to this page and download the library: Download groe/craft-sitemap library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
groe / craft-sitemap example snippets
public function renderSitemap()
{
// Get an ElementCriteriaModel from the ElementsService
$criteria = craft()->elements->getCriteria(ElementType::Entry);
// Specify that we want entries within the ‘locations’ section
$criteria->section = 'locations';
// Loop through any entries that were found
foreach ($criteria->find() as $locationEntry)
{
// Here we’re building a path using the entry slug.
// This might match a custom route you’ve defined that
// should be ChangeFrequency::Daily, 0.5);
}
}