statamic / ssg

The official Statamic Static Site Generator
232 stars 24 forks source link

Set view paths on each page, taking multi-site into consideration #129

Closed davebarrau closed 1 year ago

davebarrau commented 1 year ago

Fixes #127.

Currently if you have two sites in a multi-site setup, say, for example, default and test.

Using php please ssg:generate, if you attempt to generate a page that is part of the test site, the view path resources/views/test/ will never be added to the list of view paths to find files in, so you cannot override the layouts/partials/other files.

Because statamic/cms has the AddViewPaths HTTP middleware, it works when visiting the site, just not when using the static site generator. Ideally the logic currently in the AddViewPaths middleware would be split out so SSG can use the parts of it it needs, but this should hopefully be a sufficient improvement for now.

Co-authored by: @michaelr0

what-the-diff[bot] commented 1 year ago
davebarrau commented 1 year ago

@jasonvarga When you get a chance, can you please review this? 🙇

jasonvarga commented 1 year ago

Closing this as it's been sitting a while, and needs changes applied in order to work properly. If you'd like to make the requested changes we can reopen it. Thanks!