mix phoenix_page_meta.install (PhoenixPageMeta v0.1.1)

Copy Markdown View Source

Sets up phoenix_page_meta in the Phoenix project

Performs three steps:

  1. Creates <AppWeb>.PageMeta — the project-local struct module that use PhoenixPageMeta injects behaviour and helpers into.

  2. Injects <PhoenixPageMeta.Components.MetaTags.default> into lib/<app_web>/components/layouts/root.html.heex, right before the existing <.live_title element.

  3. Adds @behaviour PhoenixPageMeta.LiveView and import PhoenixPageMeta.LiveView, only: [assign_page_meta: 1] after use Phoenix.LiveView inside the def live_view macro in the main web module.

All three steps are idempotent — re-running the task is safe.

Example

mix phoenix_page_meta.install