1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 10:27:06 +00:00

add Route.ExcludeSitemap method to exclude a route from sitemap, also exclude the offline routes as requested

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-08-29 01:21:42 +03:00
parent 6f9a453160
commit 00684f9d2e
4 changed files with 22 additions and 2 deletions

View File

@@ -439,6 +439,11 @@ func WithOtherValue(key string, val interface{}) Configurator {
// WithSitemap enables the sitemap generator.
// Use the Route's `SetLastMod`, `SetChangeFreq` and `SetPriority` to modify
// the sitemap's URL child element properties.
// Excluded routes:
// - dynamic
// - subdomain
// - offline
// - ExcludeSitemap method called
//
// It accepts a "startURL" input argument which
// is the prefix for the registered routes that will be included in the sitemap.
@@ -462,7 +467,7 @@ func WithSitemap(startURL string) Configurator {
}
for _, r := range app.GetRoutes() {
if !r.IsStatic() || r.Subdomain != "" {
if !r.IsStatic() || r.Subdomain != "" || !r.IsOnline() || r.NoSitemap {
continue
}