2

My website features music releases. On the homepage, it shows the current week of releases. It also offers the ability to go back to previous weeks and see the releases e.g. mysite.com/new-releases/05-27-2022

To do this, I have a route set up:

enter image description here

These pages are generated via some logic in the home page twig template which means the pages aren't actually entries.

The pages do not appear in SEOMatic and therefore not included in the sitemap or have their own SEO tags.

It also causes problems with Blitz caching because it doesn't know to warm these pages automatically because it only looks for entries.

Is there a better way to do this?

1 Answer 1

2

Using routes for automatically generated content is the correct way to do this. The only thing I would change about your setup is using more specific placeholders for the date format, but besides that, the route is fine.

I would solve this by adjusting the way you use those plugins. This is why I don't like plugins like SEOmatic - they save you some time in the beginning (though arguably, they come with a lot of stuff that you don't really need). But later on they make easy tasks harder than they need to be.

You're gonna have to either figure out how to include your custom route in the features you mentioned, or remove those plugins and/or disable the features that are causing problems. For example, having a broken sitemap is worse than having no sitemap at all – as long as you have a good internal linking structure and all pages are reachable through the normal navigation and additional on-site links. Missing a couple of archived routes that probably aren't seeing tons of traffic in the cache warm-up isn't a big deal either.

You can also use the configuration options and hooks provided to cleanly integrate your custom route into the features you mentioned. For example:

  • For the SEOmatic sitemap, the plugin uses events for the Sitemap generation that you can hook into to add your custom URLs. Check out the documentation on the EVENT_REGISTER_SITEMAP_URLS event to get started.
  • For Blitz Cache Generation, you can specify custom URLs in the settings. You can use that to configure all archive links for now and the forseeable future. Another option would be a custom cache generator that's aware of your archive links.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.