mix compile.seo_jsonld (SEO v0.3.0-rc.0)

View Source

Generates and compiles SEO.JSONLD.* typed builder modules from the Schema.org vocabulary bundled with :phoenix_seo.

Usage

Add the compiler to your project's compiler list:

def project do
  [
    compilers: [:seo_jsonld] ++ Mix.compilers(),
    # ...
  ]
end

Pick which Schema.org types to materialize via application config. Accepts a single entry or a list of entries:

config :phoenix_seo, json_ld_types: :all
config :phoenix_seo, json_ld_types: [:google, SEO.JSONLD.SearchAction]

Available config entries

  • :google — the types Google has rich-result guides for plus their supporting types (~200 modules with their closure). This is the default.
  • :all — every regular Schema.org class (~820 modules).
  • Category atoms like :medical, :place, :travel, :shopping, :creative_work, :action, etc. See Mix.Tasks.Compile.SeoJsonld.Generator.groups/0 for the full list.
  • Module names like SEO.JSONLD.Article (or strings like "Article" / "schema:Article").

Ancestors and referenced types are pulled into the emit set automatically, so the typespecs always resolve.

Defaults to :google when no config is supplied.