Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multisite view overrides not working with statmic ssg #128

Closed
michaelr0 opened this issue Mar 14, 2023 · 3 comments
Closed

Multisite view overrides not working with statmic ssg #128

michaelr0 opened this issue Mar 14, 2023 · 3 comments

Comments

@michaelr0
Copy link

michaelr0 commented Mar 14, 2023

Bug description

It looks like there is an issue with generating multisite pages with the SSG package, when trying to use view overrides for particular sites/pages.

The below PR's might be related as those appeared to have removed the viewPath's in favour of moving it into a middleware and solving a SSG performance issue.

statamic/cms#7030
#120

How to reproduce

  • Create a new Statamic Multisite with SSG
  • Create different resources/views/<site1>/home.antlers.html and resources/views/<site2>/home.antlers.html files
  • Run php artisan view:clear
  • 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

Logs

No response

Environment

php please support:details

Environment
Application Name: Statamic
Laravel Version: 9.52.4
PHP Version: 8.1.16
Composer Version: 2.5.4
Environment: local
Debug Mode: ENABLED
URL: mysite.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 1
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 3.4.5 PRO

Statamic Addons
statamic/ssg: 1.3.0

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

regex (default)

Additional details

No response

@duncanmcclean
Copy link
Member

This issue might belong better on the statamic/ssg repository - I'll leave it for the Statamic Team to move it if they feel necessary.

@jasonvarga jasonvarga transferred this issue from statamic/cms Mar 14, 2023
@michaelr0
Copy link
Author

michaelr0 commented Mar 14, 2023

This and #127 are the for the same issue.

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 statamic/cms@01cc304 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?).

@michaelr0
Copy link
Author

Closing in favour of #127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants