0

Magento が現在の日付をサイトマップの lastmod フィールドに入れるという事実を修正するために。これはクロール率の低下につながります。Sitemap.php ( app/code/local/Mage/Sitemap/Model/Sitemap.php ) の日付を次のように変更しました。

    /*
     * Generate categories sitemap
     **/

    $changefreq = (string)Mage::getStoreConfig('sitemap/category/changefreq', $storeId);
    $priority   = (string)Mage::getStoreConfig('sitemap/category/priority', $storeId);
    $collection = Mage::getResourceModel('sitemap/catalog_category')->getCollection($storeId);
    foreach ($collection as $item) {
        $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>',
            htmlspecialchars($baseUrl . $item->getUrl()),
            substr(Mage::getModel('catalog/category')->load($item->getId())->getUpdatedAt(),0,10),  //---> here the changes
            $changefreq,
            $priority
        );
        $io->streamWrite($xml);
    }

それはうまくいきますが、私のsitemap.xml(www.edenglamode.com/sitemap.xml)のいくつかのURLでlastmodが空であることに気づいたので、Googleはそれについて不平を言いました。

<url>
 <loc>
   http://www.edenglamode.com/robe-courte-sexy-bustier-avec-ceinture.html
 </loc>
   <lastmod/>
   <changefreq>hourly</changefreq>
  <priority>1.0</priority>
</url>

それを修正するのを手伝ってもらえますか?

4

1 に答える 1

0

製品の lastmod 時刻が NULL の場合は、製品をロードし、DATE を lastmod として追加し、製品を保存して、DATE を XML に書き出す必要があります。次回はlastmodが存在するので問題はありません。その後、Magento が製品をロードして保存するのを待つことなく、サイトマップ エントリを書き出すことができます。

最終更新回数がなくなった理由についてお尋ねしてもよろしいですか? 製品をまとめてインポートし、管理者で開かなかったのですか?

于 2012-09-20T18:47:19.017 に答える