Search documentation of phoenix_kit

# PhoenixKit.Modules.Sitemap.HtmlGenerator (phoenix_kit v1.7.87)

Copy Markdown View Source

HTML sitemap renderer for PhoenixKit.

Generates human-readable HTML sitemaps in three styles:

- hierarchical - grouped by category, then by first letter
- grouped - grouped by category/source
- flat - single alphabetical list with multi-column layout

HTML sitemaps are generated on-the-fly and cached in ETS via `Cache`. They are NOT written to disk (unlike XML sitemaps).

## Summary

### Functions

generate(opts, entries, cache_key, cache_opts \\ [])

Renders an HTML sitemap from pre-collected URL entries.

## Functions

# generate(opts, entries, cache_key, cache_opts \\ [])

    @spec generate(
      keyword(),
      [PhoenixKit.Modules.Sitemap.UrlEntry.t()],
      atom(),
      keyword()
    ) ::
      {:ok, String.t()}

Renders an HTML sitemap from pre-collected URL entries.

Validation and cache lookup are handled by the caller (`Generator.generate_html/1`). This function only renders HTML and optionally caches the result.

## Parameters

- `opts` - Options (`:style`, `:title`)
- `entries` - Pre-collected URL entries
- `cache_key` - Atom key for ETS cache storage
- `cache_opts` - Optional: `[cache: false]` to skip caching