besteadfast / carbon

Steadfast's starter project - Craft CMS, Vite, and DDEV
3 stars 2 forks source link

Disable public template routing #44

Closed jakedohm closed 9 months ago

jakedohm commented 9 months ago

Currently if you have a template in /templates without a _ prefix, Craft will automatically generate a Route matching that path for you. This can seem useful, but I'd argue is more likely to cause an issue than to be helpful.

I argue that for a few reasons:

  1. We don't always remember this and prefix our templates correctly, which can lead to unexpected routes and duplicate URLs.
  2. Our filesystem shouldn't have to mirror our URLs.
  3. 95% of pages should have a corresponding entry in Craft. Even something like a blog index page still needs at least SEO fields in the CMS (even if it doesn't need any other fields). Pages like that should be a single mapped to a template.
  4. If you really want to have a route without an entry, you can create that easily using config/craft/routes.php