View Source Liquor.Tags.Tag (Liquor Tags v1.0.2)
The Tag module holds the structure for a Tag. A Tag consist of a identification string (tag) a URI for OpenGraph (base_url) and a pseudo EEx template string.
Summary
Functions
Helps creating a new Tag. The template is a string with pseudo EEx (for safer evaluation). The URI is a string that can be used as a base URL for all the tags when fetching the Open Graph data.
A safer way to replace the tags Instead of EEx.eval_string() This function is recommended to use cases when the user can send input.
Types
A Tag consists of a string identification (tag), an URI and an pseudo EEx template string
Functions
Helps creating a new Tag. The template is a string with pseudo EEx (for safer evaluation). The URI is a string that can be used as a base URL for all the tags when fetching the Open Graph data.
Examples
iex> Liquor.Tags.Tag.new("embed", "<%= og.title %>")
%Liquor.Tags.Tag{tag: "embed", template: "<%= og.title %>", uri: %URI{}}
A safer way to replace the tags Instead of EEx.eval_string() This function is recommended to use cases when the user can send input.
The template string can use a pseudo EEx tags.
Example <%= og.title %>
for rendering the
open graph data.
Check https://github.com/bitboxer/opengraph_parser/blob/main/lib/open_graph.ex#L55 for all the available keys.
Examples
iex> Liquor.Tags.Tag.render(Liquor.Tags.Tag.new("embed", "<%= og.title %>"), [og: %OpenGraph{title: "A Sample Title"}])
"A Sample Title"