Search documentation of phoenix_kit

# PhoenixKitWeb.SitemapController (phoenix_kit v1.6.19)

View Source

Controller for serving XML sitemaps with XSL styling.

Provides public endpoints for sitemap access:

- GET /{prefix}/sitemap.xml - XML sitemap with XSL stylesheet reference
- GET /{prefix}/sitemap.html - Redirects to sitemap.xml (deprecated)
- GET /{prefix}/sitemap-{n}.xml - Sitemap index parts (for large sites)
- GET /{prefix}/assets/sitemap-{style}.xsl - XSL stylesheets

All endpoints are cached for performance with configurable cache headers.

## XSL Stylesheets

The XML sitemap includes an XSL stylesheet reference that enables beautiful browser display without generating separate HTML files. Available styles:

- table - Clean table layout
- cards - Cards grouped by category
- minimal - Simple list of links

# Summary

## Functions

html(conn, params)

Redirects to XML sitemap (deprecated).

index_part(conn, map)

Serves sitemap index part files for large sitemaps.

xml(conn, params)

Serves the XML sitemap.

xsl_stylesheet(conn, map)

Serves XSL stylesheet files for sitemap display.

# Functions

# html(conn, params)

Redirects to XML sitemap (deprecated).

HTML sitemap is now served by opening sitemap.xml with XSL styling. This endpoint is kept for backward compatibility.

# index_part(conn, map)

Serves sitemap index part files for large sitemaps.

URL format: /sitemap-{index}.xml where index is 1-based. Returns 404 if the index doesn't exist.

# xml(conn, params)

Serves the XML sitemap.

- Search engine bots receive clean XML (no XSL reference)
- Browsers receive styled HTML page (server-side transformation)

Detection is based on Accept header and User-Agent.

Returns 404 if sitemap module is disabled. Returns 500 if sitemap generation fails.

# xsl_stylesheet(conn, map)

Serves XSL stylesheet files for sitemap display.

Available styles: table, cards, minimal