Still.Compiler.TemplateHelpers (Still v0.8.0) View Source

Set of helper functions to be included in a file that runs through an Elixir preprocessor.

Link to this section Summary

Link to this section Functions

Link to this function

get_collections(env, collection)

View Source

Returns the collections for the current file.

Link to this function

include(env, file, metadata \\ %{})

View Source

Renders a file in the page using the variables defined in metadata.

Link to this function

link(env, content, opts)

View Source

Renders the link using Still.Compiler.TemplateHelpers.Link.render/3.

Converts a relative path to an absolute one.

Examples

File paths are always relative to the root folder, but sometimes it's too cumbersome, and we need to reference a file relative to the current folder.

For instance, when called inside the file "blog/post/index.md":

path_expand("./cover.png")
# "blog/post/./cover.png"
Link to this function

responsive_image(file, opts \\ [])

View Source

See Still.Image.TemplateHelpers.render_html/2.

Safely renders the content by escaping any HTML tags.

Link to this function

truncate(str, opts \\ [])

View Source

Truncates the string.

Options

  • escape - apply safe_html/1 after truncating. Defaults to false.

See further supported options in Still.TemplateHelpers.Truncate.

See Still.Compiler.TemplateHelpers.UrlFor.render/1.