The Multi-Site docs state that you can arrange your directory structure so that if resources/views/<site name>/ exists, it will preference that over resources/views/.
This currently works in statamic/cms for the control panel + anything web-based, but not for ssg:generate for me (using statamic/cms:v3.4.4 and statamic/ssg:1.3.0).
I believe this may have been a regression when https://github.com/statamic/cms/commit/01cc304545a60850d5df16cbe05e2dd9d6b38f02 was introduced, as that commit moved addViewPaths() to a web middleware and removed the call from DataResponse::toResponse(). I believe ssg:generate uses DataResponse::toResponse() (via Page::write()) but does nothing with this new middleware, which means the per-site view path is not set correctly when using the static site generator.
Adding ->addViewPaths() back in to DataResponse::toResponse()fixes it for me (edit: scratch that, it reintroduces the exponential loop issue that was previously fixed), but I'm not sure if it was removed for a reason (perhaps to fix another bug?).
I’ll copy what I experienced from that issue into this comment.
Run SSG generate and see that site1 and site2 will use the override of site1
Run SSG generate again and you may see that the overrides aren't used, both site1 and site2 will fallback to resources/views/home.antlers.html instead of the site override
The Multi-Site docs state that you can arrange your directory structure so that if
resources/views/<site name>/
exists, it will preference that overresources/views/
.This currently works in
statamic/cms
for the control panel + anything web-based, but not forssg:generate
for me (using statamic/cms:v3.4.4 and statamic/ssg:1.3.0).I believe this may have been a regression when https://github.com/statamic/cms/commit/01cc304545a60850d5df16cbe05e2dd9d6b38f02 was introduced, as that commit moved
addViewPaths()
to a web middleware and removed the call fromDataResponse::toResponse()
. I believessg:generate
usesDataResponse::toResponse()
(viaPage::write()
) but does nothing with this new middleware, which means the per-site view path is not set correctly when using the static site generator.Adding
->addViewPaths()
back in toDataResponse::toResponse()
fixes it for me(edit: scratch that, it reintroduces the exponential loop issue that was previously fixed), but I'm not sure if it was removed for a reason (perhaps to fix another bug?).