# Changelog
## [0.2.0] - 2026-06-20
### Added
- `PhoenixPageMeta.PageMeta` — a prebuilt, config-driven PageMeta struct. The
field set is assembled at compile time from a fixed base plus
`config :phoenix_page_meta, extra_fields: [...]` (bare atoms and
`{key, default}` pairs may be mixed; later entries override earlier ones).
Site-wide values (`og_type`, `site_name`, `twitter_site`,
`supported_locales`) are sourced from config as struct defaults. No
per-app `defstruct`, no `use`.
- Config-driven base URL resolution for the prebuilt struct: `:base_url`
(string, `&Mod.url/0`, or `{m, f, a}`), `:endpoint` (explicit module), or
auto-detection of the single running `Phoenix.Endpoint` (memoized in
`:persistent_term`). `:lang_path` config (`fun/2` or `{m, f}`) overrides the
default locale-prefix swap.
- `config :phoenix_page_meta, extra_enforce_keys: [...]` to make extra fields
required alongside `:title`/`:path`.
### Changed
- `use PhoenixPageMeta` (with a hand-rolled `defstruct`) is **deprecated** in
favour of `PhoenixPageMeta.PageMeta`. It still works and emits a compile-time
deprecation warning; it will be removed in a future release. The wiring it
injects is now shared via the internal `PhoenixPageMeta.__setup__/1` macro.
## [0.1.3] - 2026-06-12
### Changed
- Repository moved to https://github.com/saschabrink/phoenix_page_meta — package
metadata, docs links, and license now reflect the maintainer's real name.
- CI tests against Elixir 1.19 and 1.20 via the Nix flake dev shells.
- README badges for Hex version, docs, CI status, and license.
### Fixed
- The `precommit` alias misspelled `--warnings-as-errors`, so compiler
warnings were never treated as errors locally.
## [0.1.2] - 2026-05-13
### Added
- `mix phoenix_page_meta.install` now also adds `alias <AppWeb>.PageMeta`
inside `defp html_helpers` in the web module, so templates and LiveViews
can reference `%PageMeta{}` directly without the prefix. Idempotent; warns
(does not error) if `defp html_helpers` cannot be found.
## [0.1.1] - 2026-05-13
### Added
- `mix phoenix_page_meta.install` — Igniter-powered installer that sets up the
PageMeta struct, root.html.heex meta tags, and LiveView callback wiring in one
step. Run via `mix igniter.install phoenix_page_meta` or directly with
`mix phoenix_page_meta.install`.
## [0.1.0] - 2026-04-27
### Added
- `use PhoenixPageMeta` macro — single line of setup in `MyAppWeb.PageMeta`. Injects `@behaviour PhoenixPageMeta.Site`, `breadcrumbs/1` and `active?/2,3` wrappers (pattern-matched to the project struct), default `base_url/0` and `lang_path/2` (both `defoverridable`), and `@after_compile` field validation.
- `PhoenixPageMeta.Breadcrumb` — struct (`:title`, `:path`, `:first?`, `:last?`, `:page_meta`) + `build/1` (walks `:parent` chain, filters `:skip_breadcrumb`).
- `PhoenixPageMeta.Components.Breadcrumbs.list/1` — slot-based HEEx component owning `<nav aria-label>`, `aria-current="page"`, and divider placement. Accepts `:rest` globals (e.g. `class`).
- `PhoenixPageMeta.Components.MetaTags.default/1` — HEEx component rendering description, Open Graph (`og:type`, `og:url`, `og:title`, `og:description`, `og:image`, `og:image:alt`, `og:site_name`, `og:locale`, `og:locale:alternate`), Twitter Card (`twitter:card`, `twitter:title`, `twitter:description`, `twitter:image`, `twitter:site`), JSON-LD, canonical, and hreflang alternate tags. Reads optional fields with `Map.get/2`.
- URL fields (`og_image`, `canonical_path`) auto-prefixed with `base_url` when relative. Absolute URLs (`http://`/`https://`) rendered as-is.
- New struct fields recognised by `MetaTags`: `:site_name` (renders `og:site_name`), `:twitter_site` (renders `twitter:site`), `:og_image_alt` (renders `og:image:alt`, falls back to `:title`), `:locale` (renders `og:locale` and derives `og:locale:alternate` from the rest of `:supported_locales`).
- `PhoenixPageMeta.active?/2,3` — link path matching against the current page (`exact:` and `query:` opts), with slash-boundary prefix matching.
- `PhoenixPageMeta.Site` — behaviour for site-wide callbacks (`base_url/0`, `lang_path/2`).
- `PhoenixPageMeta.LiveView` — behaviour for the per-LiveView `page_meta/2` callback, plus `assign_page_meta/1` helper.
- Components dispatch site-wide callbacks via `page_meta.__struct__` — no global config.
- `:base_url` option on `use` accepts a string or a 0-arity function capture. When omitted, the macro guesses `MyAppWeb.Endpoint.url()` from the namespace.
- `:lang_path/2` default does locale-prefix swap; override for non-prefix locale schemes.