seo icon indicating copy to clipboard operation
seo copied to clipboard

Categories for sitemap not saved and empty sections in sitemap

Open WHITE-developer opened this issue 3 years ago • 1 comments

Description

It doesn't save the category settings on the sitemap page. Looks like it has something to do with the empty hidden category-field in the product type part: https://github.com/ethercreative/seo/blob/v3/src/templates/sitemap.twig#L190

Then we also have empty sitemap sections. The main sitemap has several sections, but they're all empty except for the file ending with a _0.xml.

<?xml version="1.0" encoding="utf-8"?>
  | <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_1_0.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_1_1.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_1_2.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_1_3.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_1_4.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_1_5.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_1_6.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_3_0.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_3_1.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_3_2.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_3_3.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_3_4.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_3_5.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_3_6.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_8_0.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_8_1.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_8_2.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_8_3.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_8_4.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_8_5.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_sections_8_6.xml</loc><lastmod>2022-02-08T20:00:55+01:00</lastmod></sitemap><sitemap><loc>https://just-a-random-website.nl/sitemap_categories_1_0.xml</loc><lastmod>2021-06-22T16:53:40+02:00</lastmod></sitemap></sitemapindex>

Example of an empty section, sitemap_sections_3_6.xml:

<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"/>

Additional info

  • Craft version: 3.7.30.1
  • SEO version: 3.7.4
  • PHP version: 7.4.10
  • Database driver & version: MySQL 5.7

WHITE-developer avatar Feb 08 '22 16:02 WHITE-developer

I'm getting the same issue.

Upgraded from SEO 3.6.7 > 3.7.4 so that we can get commerce products sitemaps. Once upgraded categories stoped working.

As per @WHITE-developer note - it's the line https://github.com/ethercreative/seo/blob/v3/src/templates/sitemap.twig#L190 that's the issue - this needs to be changed to:

<input type="hidden" name="productTypes" value="">

This fixes the issue.

anchovy avatar Mar 08 '22 21:03 anchovy