@@ -73,6 +73,11 @@ class Router
7373 'lingo.routes ' => [],
7474 ];
7575
76+ /**
77+ * Sitemap options
78+ */
79+ protected static $ sitemapOptions = [];
80+
7681 /**
7782 * Current group base path
7883 */
@@ -127,6 +132,7 @@ public static function mount(string $path, $handler)
127132 $ initialNamespace = static ::$ namespace ;
128133 $ initialGroupRoute = static ::$ groupRoute ;
129134 $ initialLingoOptioins = static ::$ lingoOptions ;
135+ $ initialSitemapOptions = static ::$ sitemapOptions ;
130136 $ initialGroupMiddleware = static ::$ routeGroupMiddleware ;
131137
132138 if ($ groupOptions ['namespace ' ]) {
@@ -147,11 +153,16 @@ public static function mount(string $path, $handler)
147153 static ::$ lingoOptions ['lingo.no_locale_prefix ' ] = $ groupOptions ['lingo.no_locale_prefix ' ];
148154 }
149155
156+ if (isset ($ groupOptions ['sitemap ' ])) {
157+ static ::$ sitemapOptions = $ groupOptions ['sitemap ' ];
158+ }
159+
150160 call_user_func ($ handler );
151161
152162 static ::$ namespace = $ initialNamespace ;
153163 static ::$ groupRoute = $ initialGroupRoute ;
154164 static ::$ lingoOptions = $ initialLingoOptioins ;
165+ static ::$ sitemapOptions = $ initialSitemapOptions ;
155166 static ::$ routeGroupMiddleware = $ initialGroupMiddleware ;
156167 }
157168
@@ -197,10 +208,19 @@ public static function match(string $allowedMethods, string $pattern, $handler)
197208 }
198209
199210 foreach ($ methods as $ method ) {
211+ $ sitemapOptions = [];
212+
213+ if (isset ($ routeOptions ['sitemap ' ])) {
214+ $ sitemapOptions = $ routeOptions ['sitemap ' ];
215+ } elseif (static ::$ sitemapOptions === false || (is_array (static ::$ sitemapOptions ) && !empty (static ::$ sitemapOptions ))) {
216+ $ sitemapOptions = static ::$ sitemapOptions ;
217+ }
218+
200219 static ::$ routes [$ method ][] = [
201220 'pattern ' => $ pattern ,
202221 'handler ' => $ handler ,
203222 'name ' => $ routeOptions ['name ' ] ?? '' ,
223+ 'sitemap ' => $ sitemapOptions ,
204224 'lingo.routes ' => $ routeOptions ['lingo.routes ' ] ?? static ::$ lingoOptions ['lingo.routes ' ] ?? [],
205225 'lingo.no_locale_prefix ' => $ routeOptions ['lingo.no_locale_prefix ' ] ?? static ::$ lingoOptions ['lingo.no_locale_prefix ' ] ?? false ,
206226 ];
@@ -856,7 +876,7 @@ public static function run(?callable $callback = null)
856876 $ requestedMethod = \Leaf \Http \Request::getMethod ();
857877 $ appDown = _env ('APP_DOWN ' , \Leaf \Anchor::toBool (\Leaf \Config::getStatic ('app.down ' )) ?? false );
858878
859- if ($ appDown === true ) {
879+ if ($ appDown == ' true ' ) {
860880 if (!static ::$ downHandler ) {
861881 static ::$ downHandler = function () {
862882 \Leaf \Exception \General::defaultDown ();
0 commit comments