I have successfully generated a sitemap on M2.3.5-p2 | However google webmaster sitemap coverage throws an error us invalid URL for a majority of my generated urls.
Upon close examination. it seems a majority of my urls have the following :
<url> <loc>https://www.domian.com/shop-parts/license-plate/brackets.html</loc> <lastmod>0000-01-01T00:00:00+00:00</lastmod> <changefreq>daily</changefreq> <priority>0.5</priority> </url> <url> <loc>https://www.domain.com/shop-parts/heating.html</loc> <lastmod>0000-01-01T00:00:00+00:00</lastmod> <changefreq>daily</changefreq> <priority>0.5</priority> </url>
Hi @donweb ,
The value of <lastmod> comes from the updated_at field of item (category,product,cms page). If there is no updated_at time, constant LAST_MOD_MIN_VAL is being assigned to the variable $lastModMinTsVal
check the code below
vendor/magento/module-sitemap/Model/Sitemap.php
...
protected function _getFormattedLastmodDate($date)
{
if ($this->lastModMinTsVal === null) {
$this->lastModMinTsVal = strtotime(self::LAST_MOD_MIN_VAL);
}
$timestamp = max(strtotime($date), $this->lastModMinTsVal);
return date('c', $timestamp);
}
...
...
public function generateXml()
{
$this->_initSitemapItems();
/** @var $item SitemapItemInterface */
foreach ($this->_sitemapItems as $item) {
$xml = $this->_getSitemapRow(
$item->getUrl(),
$item->getUpdatedAt(),
$item->getChangeFrequency(),
$item->getPriority(),
$item->getImages()
);
...I will suggest you please check your entries update_at column in database, It may be possible after migration, something has not happened as expected.
Find helpful? Consider Giving Kudos to this post.
Problem solved? Click Accept as Solution!