cancel
Showing results for 
Search instead for 
Did you mean: 

Generated sitemap Successfully on M2.3.5-p2 | However google webmaster error us invalid URL.

Generated sitemap Successfully on M2.3.5-p2 | However google webmaster error us invalid URL.

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>
the lastomd populates as 0000-01-01T00:00:00+00:00
 
How can I change this to a more current value so that my links can be properly crawled by the search engines.
 
PS: This site was migrated from magent 1.9. If that adds a little more clarity.

 

 

1 REPLY 1

Re: Generated sitemap Successfully on M2.3.5-p2 | However google webmaster error us invalid 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!