File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -29,13 +29,26 @@ protected function registerServices()
2929 }
3030
3131 /**
32- * Extract the Statamic template data for the
33- * current entry and pass it to our singleton.
32+ * Process the view data that has been set up
33+ * by Statamic. This is very convoluted but
34+ * it's efficient!
3435 */
3536 protected function registerViewComposers ()
3637 {
3738 // Append slash to path if necessary
3839 $ path = substr (request ()->path (), 0 , 1 ) == '/ ' ? request ()->path () : '/ ' . request ()->path ();
40+
41+ // Remove multisite url prefixes if necessary (we can't find entries by uri when they are prefixed)
42+ foreach (\Statamic \Facades \Site::all () as $ site ) {
43+
44+ $ sitePrefix = str_replace (request ()->root (), '' , $ site ->url );
45+
46+ if (strlen ($ sitePrefix ) && str_starts_with ($ path , $ sitePrefix )) {
47+ $ path = substr ($ path , strlen ($ sitePrefix ));
48+ }
49+
50+ }
51+
3952 $ template = null ;
4053
4154 if ($ entry = Entry::findByUri ($ path )) {
You can’t perform that action at this time.
0 commit comments