Search documentation of phoenix_kit

# PhoenixKit.Sitemap.Sources.RouterDiscovery (phoenix_kit v1.6.19)

View Source

Router Discovery source for sitemap generation.

Automatically scans all GET routes from the parent application's router and includes them in the sitemap. Routes can be filtered using exclude patterns and include-only patterns.

## Settings

- `sitemap_router_discovery_enabled` - Enable/disable auto-discovery (default: true)
- `sitemap_router_discovery_exclude_patterns` - JSON array of regex patterns to exclude
- `sitemap_router_discovery_include_only` - JSON array of regex patterns for whitelist mode

## Default Exclusions

By default, the following patterns are excluded:

- `^/admin` - Admin routes
- `^/api` - API endpoints
- `^/phoenix_kit` - PhoenixKit admin routes
- `^/dev` - Development routes
- `:[a-z_]+` - Routes with parameters
- `\*` - Wildcard routes

## Examples

    # Enable auto-discovery (default)
    Settings.update_boolean_setting("sitemap_router_discovery_enabled", true)

    # Custom exclude patterns
    Settings.update_setting("sitemap_router_discovery_exclude_patterns",
      Jason.encode!(["^/admin", "^/api", "^/private"]))

    # Whitelist mode - only include specific paths
    Settings.update_setting("sitemap_router_discovery_include_only",
      Jason.encode!(["^/products", "^/categories"]))

## Sitemap Properties

- Priority: 0.5 (default for discovered routes)
- Change frequency: weekly
- Category: "Routes"