vaersaagod / seomate

SEO, mate! It's important. That's why SEOMate provides the tools you need to craft all the meta tags, sitemaps and JSON-LD microdata you need - in one highly configurable, open and friendly package - with a super-light footprint.
MIT License
36 stars 8 forks source link

How to specify URL of sitemap entry #64

Closed mattbloomfield closed 2 years ago

mattbloomfield commented 2 years ago

Admittedly this is a little weird. But I have a section in my site where the entries power 2 pages each.

It's a section of people, and each can have 0, 1, or 2 pages associated with them. We have toggles on the entry to handle their creation.

The first page type is configured in the normal way with a conditional in the URL field so it's blank if the toggle is turned off. This works great with SeoMate's Sitemap.

The second page type is configured via the config/routes.php file. If you hit the route and pass it the slug of the entry, it does a lookup. If it doesn't exist or if the toggle is disabled it does an {% exit 404 %}. This works.

However, in hooking it into the sitemap I am unable to specify the URL. So it has the URL of the first page type. See here:

'videoPeople' => [
        'elementType' => \craft\elements\Entry::class,
        'criteria' => [
          'section' => 'people',
          'featureEnabled_DefaultOff' => true
        ],
        'params' => ['changefreq' => 'weekly', 'priority' => .7]
      ],

Is there something I can pass in the config to allow me to kind of hardcode the URL or something?

mmikkel commented 2 years ago

Have you looked at the additionalSitemaps config setting? Creating your own, custom sitemap containing links to these routed entries, is probably your best bet.

mattbloomfield commented 2 years ago

Oh that's a smart approach. I think I got a little lost in the trees, but this will work fine. Thank you!