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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user