Closed kasperkamperman closed 1 year ago
Hi @kasperkamperman and thanks for the proposal. Currently, the generators' addURL()
function has a signature with all parameters except the path having default values (equal to null
or empty array), which means, according to the PHP specification, that they can be omitted. Also, the documentation of the method also shows that the value can be of type string
or null. Do you think there's another way to mark them as optional?
/**
* Add url components.
* Instead of storing all urls in the memory, the generator will flush sets of added urls
* to the temporary files created on your disk.
* The file format is 'sm-{index}-{timestamp}.xml'
* @param string $path
* @param DateTime|null $lastModified
* @param string|null $changeFrequency
* @param float|null $priority
* @param array|null $alternates
* @param array $extensions
* @return $this
*/
public function addURL(
string $path,
DateTime $lastModified = null,
string $changeFrequency = null,
float $priority = null,
array $alternates = null,
array $extensions = []
)
https://developers.google.com/search/docs/crawling-indexing/sitemaps/overview
I actually passed null and that removed lastmod from the generated sitemap. Maybe good to mention that somewhere.
$generator->addURL('/blauwalg-radar', null, 'daily', $priority+0.5);