GamendWeb.Plugs.PageMeta (gamend_web v1.0.1216)

Copy Markdown View Source

Assigns per-page SEO metadata so the root layout can render a <meta name="description"> that is unique to the page.

Without this every page inherits the theme's site-wide description, which search engines treat as duplicate boilerplate and which suppresses click-through on every page but the landing page.

The copy itself is host content, not core's business, so it comes from a host-supplied provider configured as

config :gamend_web, page_meta_provider: MyHost.PageMeta

The provider implements:

  • describe(path) :: String.t() | nil — the meta description

  • title(path) :: String.t() | nil — an optional SEO <title>, used when the in-page :page_title is a short UI label ("Learn") rather than something anyone searches for ("Vocabulary Lists for 50 Languages")

  • json_ld(path) :: [map()] — schema.org objects for the page, rendered as application/ld+json
  • breadcrumbs(path) :: [{String.t(), String.t() | nil}] — the trail, as {label, path} pairs ending with the current page (whose path may be nil). The layout renders it and the provider should build its BreadcrumbList markup from the same list, so the two cannot drift.

Returning nil (or []) leaves the assign unset and the layout falls back to the page title and theme description.

Runs in the :browser pipeline, so the assign is present for the initial render of both controller pages and LiveViews — which is the render crawlers see.

Summary

Functions

call(conn, opts)

init(opts)