DOCUMENTATION: add documentation for controller with sitemap
This commit is contained in:
@@ -22,13 +22,22 @@ class Sitemap extends Controller
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sitemap for all content pages
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMap()
|
||||
{
|
||||
// load all public pages
|
||||
$pages = $this->content->getPageQuery()
|
||||
->get();
|
||||
|
||||
|
||||
// iterate over all pages and add tag for each of them
|
||||
foreach ($pages as $page) {
|
||||
|
||||
// is this page a homepage? because of URL
|
||||
if ($page->is_homepage) {
|
||||
$route = route('page.index');
|
||||
$priority = 1;
|
||||
@@ -37,10 +46,12 @@ class Sitemap extends Controller
|
||||
$priority = 0.8;
|
||||
}
|
||||
|
||||
// add to all pages
|
||||
\Sitemap::addTag($route, $page->updated_at, 'daily', $priority);
|
||||
|
||||
}
|
||||
|
||||
// print sitemap
|
||||
return \Sitemap::render();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user