MetaHeexComponent.Components.MetaTags (meta_heex_component v0.1.0)

Provides components for rendering meta tags in Phoenix applications.

Summary

Functions

Assigns meta tag values to the socket.

Attributes

  • meta_description (:string) - Primary meta description for SEO.

Types

meta_tag()

@type meta_tag() :: %{
  optional(:name) => String.t(),
  optional(:property) => String.t(),
  content: String.t()
}

Functions

assign_meta(socket, opts)

Assigns meta tag values to the socket.

live_meta_tags(assigns)

Attributes

  • meta_description (:string) - Primary meta description for SEO.

  • meta_keywords (:string) - Keywords for SEO.

  • author (:string) - Content author.

  • og_title (:string) - Open Graph title.

  • og_description (:string) - Open Graph description, falls back to meta_description.

  • og_type (:string) - Open Graph type (e.g., 'website', 'article').

  • og_image (:string) - Open Graph image URL.

  • og_url (:string) - Open Graph URL.

  • twitter_card (:string) - Twitter card type (e.g., 'summary_large_image', 'summary').

  • twitter_site (:string) - Twitter @username for the website.

  • twitter_title (:string) - Twitter title, falls back to og_title.

  • twitter_description (:string) - Twitter description, falls back to og_description.

  • twitter_image (:string) - Twitter image URL.

  • canonical_url (:string) - Canonical URL for SEO.

  • locale (:string) - Content language (e.g., 'en', 'es').

  • viewport (:string) - Viewport meta tag content. Common values include:

    • "width=device-width, initial-scale=1"
    • "width=device-width, initial-scale=1, shrink-to-fit-no"
    • "width=device-width, initial-scale=1, maximum-scale=1"
  • robots (:string) - Robots meta tag content (e.g., 'index,follow', 'noindex,nofollow').

  • additional_meta_tags (:list) - List of additional meta tags to be rendered. Defaults to [].