Layout template location for custom module

I have a running website on SilverStripe 4.6 with all my code in the app/src folder. I thought it would be cleaner to move my code into seperate newly created modules. I’ve been successful mostly except with the templating part.

Suppose I have vendor/myvendor/blogmodule/src/BlogPageController.php with namespace MyVendor\BlogModule\

Where should I put my template? I want it to be rendered with from my theme folder and Layout/ as the $Layout.

I’ve tried many locations like

… and more

Your template would be:


Once you’re in the templates directory, your structure needs to match the namespace of the classes.
This allows for templates to be overridden / cascaded in other places such as site themes.

My template is now in themes/mytheme/templates/MyVendor/BlogModule/Layout/ and works perfectly.

I simply move it to vendor/myvendor/blogmodule/templates/MyVendor/BlogModule/Layout/ I do ?flush and … poof, it’s gone. Just renders without BlogModule inside it.

Very confused. Maybe something to do with theme.yml in my app folder?
Name: mytheme
- '$public'
- '<mytheme>'
- '$default'