# `PhoenixBlog.Web.SEO`
[🔗](https://github.com/lalabuy948/phoenix_blog/blob/v0.1.7/lib/phoenix_blog/web/seo.ex#L1)

SEO helpers for PhoenixBlog.

Automatically generates Open Graph tags, Twitter Card tags, canonical URLs,
and JSON-LD structured data for blog pages. Used internally by the default
LiveViews.

## Setup

Add these two lines to the `<head>` in your root layout:

    <PhoenixBlog.Web.SEO.meta_tags seo={assigns[:seo]} />
    <PhoenixBlog.Web.SEO.json_ld seo={assigns[:seo]} />

These are no-ops on non-blog pages (when `@seo` is nil), so they are safe to
include in your app's global root layout.

# `assign_seo`

Assigns SEO metadata to the socket.

For the blog index page:

    PhoenixBlog.Web.SEO.assign_seo(socket, :index, uri)

For a blog post page:

    PhoenixBlog.Web.SEO.assign_seo(socket, post, uri)

# `json_ld`

## Attributes

* `seo` (`:map`) - Defaults to `nil`.

# `meta_tags`

## Attributes

* `seo` (`:map`) - Defaults to `nil`.

---

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