View Source SEO.Unfurl (SEO v0.1.10)

Some platforms (eg, Slack and Discord) have adopted an older and deprecated Twitter Product Card specification that allows for two arbitrary data points. For example, some blogs may include a reading time. Another example, if selling a product you may display a variation (eg, color is black) and also display the price (eg, price is $20).

This module should be used alongside the SEO.OpenGraph module for completeness.

For example, in the screenshot below, :label1 is "Reading Time" and :data1 is "15 minutes", and :label2 is "Published" and :data2 is "2020-01-19".

Unfurl example

Resources

Link to this section Summary

Functions

Arbitrary data points about your object. label1 and data1 both should be provided in order to render. Same with label2/data2.

Attributes

  • item (SEO.Unfurl) - Defaults to nil.
  • config (:any) - Defaults to nil.

Link to this section Types

@type t() :: %SEO.Unfurl{
  data1: nil | String.t(),
  data2: nil | String.t(),
  label1: nil | String.t(),
  label2: nil | String.t()
}

Link to this section Functions

Link to this function

build(attrs, default \\ nil)

View Source

Arbitrary data points about your object. label1 and data1 both should be provided in order to render. Same with label2/data2.

For example, label1 could be "price" and data1 could be "$10".

  • :label1 - Label describing data1
  • :data1 - 1st data point
  • :label2 - Label describing data2
  • :data2 - 2nd data point

attributes

Attributes

  • item (SEO.Unfurl) - Defaults to nil.
  • config (:any) - Defaults to nil.