Skip to content
This repository has been archived by the owner on Dec 24, 2019. It is now read-only.

Commit

Permalink
Update Sitemap.php
Browse files Browse the repository at this point in the history
Make priority param in SitemapPHP/Sitemap.php::addItem optional
  • Loading branch information
userlond committed Feb 2, 2016
1 parent fafc474 commit a5801ab
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/SitemapPHP/Sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ private function startSitemap() {
* Adds an item to sitemap
*
* @param string $loc URL of the page. This value must be less than 2,048 characters.
* @param string $priority The priority of this URL relative to other URLs on your site. Valid values range from 0.0 to 1.0.
* @param string $changefreq How frequently the page is likely to change. Valid values are always, hourly, daily, weekly, monthly, yearly and never.
* @param string|int $lastmod The date of last modification of url. Unix timestamp or any English textual datetime description.
* @param string|null $priority The priority of this URL relative to other URLs on your site. Valid values range from 0.0 to 1.0.
* @param string|null $changefreq How frequently the page is likely to change. Valid values are always, hourly, daily, weekly, monthly, yearly and never.
* @param string|int|null $lastmod The date of last modification of url. Unix timestamp or any English textual datetime description.
* @return Sitemap
*/
public function addItem($loc, $priority = self::DEFAULT_PRIORITY, $changefreq = NULL, $lastmod = NULL) {
Expand All @@ -190,7 +190,8 @@ public function addItem($loc, $priority = self::DEFAULT_PRIORITY, $changefreq =
$this->incCurrentItem();
$this->getWriter()->startElement('url');
$this->getWriter()->writeElement('loc', $this->getDomain() . $loc);
$this->getWriter()->writeElement('priority', $priority);
if($priority !== null)
$this->getWriter()->writeElement('priority', $priority);
if ($changefreq)
$this->getWriter()->writeElement('changefreq', $changefreq);
if ($lastmod)
Expand Down

0 comments on commit a5801ab

Please sign in to comment.