vaersaagod/seomate

Empty sitemap.xml

kevadamson opened this issue · 3 comments

Perhaps I'm being a donkey, but I have seomate.php with this in:

<?php

return [
    'sitemapEnabled' => true,
    'sitemapLimit' => 100,
    'sitemapConfig' => [
        'elements' => [
            'news' => ['changefreq' => 'weekly', 'priority' => 1],
        ],
    ],
];

But the sitemap.xml is just showing as:

<sitemapindex><script id="custom-useragent-string"/><!--Created on: 2019-07-26 16:49:26--></sitemapindex>

I have a News section with a handle of news that contains entries. Have a I missed something?

Your config looks sound, so there's something weird going on. Does the output actually have that script tag, <script id="custom-useragent-string"/>, in the output? That should definitely not be there, and there should also be a couple of properties on the sitemapindex tag (xmlns and xmlns:xhtml). Have you tried viewing it in source mode in your browser?

@aelvan Seems to be working now, perhaps it was cached? Is this right for Craft commerce? 'products' => ['changefreq' => 'weekly', 'priority' => 1],

Hi @kevadamson – for Craft Commerce (and any other non-Entry element types) you can't use the "shorthand" config syntax, because you need to provide the element type class, like this:

'sitemapConfig' => [
    'elements' => [
        'products' => [
            'elementType' => \craft\commerce\elements\Product::class,
            'params' => ['changefreq' => 'daily', 'priority' => 0.5],
        ],
    ]
],