# `Xenia.Sitemap`
[🔗](https://github.com/uzaydurdu/xenia/blob/v0.1.1/lib/xenia/app/sitemap.ex#L1)

A `sitemap.xml` built from your app folder's pages.

Add one route to your router, outside the `:browser` pipeline:

    get "/sitemap.xml", Xenia.Sitemap, []

It lists every page `xenia_routes` generated, with your endpoint's URL in
front (`MyAppWeb.Endpoint.url()`, or `base_url:` in the options):

  * **A page without parameters** is listed, unless it defines
    `sitemap/0` returning `[]`.
  * **A page with parameters** (`[slug]`, `[...path]`) is listed only
    with the parameters its `sitemap/0` returns, one entry each:

        def sitemap, do: for(post <- Blog.list_posts(), do: %{slug: post.slug})

    A catch-all takes a list: `%{path: ["guides", "install"]}`.
  * **Pages under a layout with `sitemap: false`** are left out, for
    example a signed-in area: `use Xenia.Layout, on_mount: ..., sitemap: false`.

Hand-written routes aren't listed. To build your own sitemap, start from
`paths/1`.

# `paths`

```elixir
@spec paths(module()) :: [String.t()]
```

The paths of the app folder's pages that belong in the sitemap, in route
order, with the router's scopes applied.

# `xml`

```elixir
@spec xml(module(), String.t()) :: String.t()
```

The sitemap as XML: one `<url>` per path from `paths/1`, after `base_url`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
