class

Hwaro::Models::OpenGraphConfig

Inherits Reference < Object

OpenGraph and Twitter Card configuration

Constructors

Instance methods

all_tags(title : String, description : String | Nil, url : String, image : String | Nil, base_url : String, og_type_override : String | Nil = nil) : String

Generate both OG and Twitter tags

Source
auto_image
Source
auto_image=(auto_image : AutoImageConfig)
Source
default_image
Source
default_image=(default_image : String | Nil)
Source
fb_app_id
Source
fb_app_id=(fb_app_id : String | Nil)
Source
og_tags(title : String, description : String | Nil, url : String, image : String | Nil, base_url : String, og_type_override : String | Nil = nil) : String

Generate OG meta tags.

og_type_override lets the renderer force og:type="website" for the homepage, section indexes, taxonomy listings, and the 404 page — the configured @og_type ("article" by default) only fits content pages. See render.cr's og_type_for helper (gh#522).

Source
og_type
Source
og_type=(og_type : String)
Source
resolve_image_url(image : String | Nil, base_url : String) : String | Nil

Resolve an image path to an absolute URL, falling back to default_image. A value that already carries its own origin (any scheme: URL, or a protocol-relative //cdn.example.com/og.png) is returned untouched: the old starts_with?("http") test sent //cdn… down the root-relative branch and emitted https://site.com//cdn.example.com/og.png as og:image, while a relative path merely starting with the letters "http" (http-guide/cover.png) was left relative — invalid for OG.

Source
twitter_card
Source
twitter_card=(twitter_card : String)
Source
twitter_card_for(img_url : String | Nil) : String

The card type for a page whose resolved image is img_url: shared by twitter_tags and the seo.twitter_card template field.

Source
twitter_creator
Source
twitter_creator=(twitter_creator : String | Nil)
Source
twitter_site
Source
twitter_site=(twitter_site : String | Nil)
Source
twitter_tags(title : String, description : String | Nil, image : String | Nil, base_url : String) : String

Generate Twitter Card meta tags

Source