Module: Archangel::Liquid::Filters::LinkToFilter

Defined in:
lib/archangel/liquid/filters/link_to_filter.rb

Overview

Link custom filters for Liquid

Instance Method Summary collapse

Instance Method Details

link_to a string

Example

{{ "Some text" | link_to: "https://example.com" }}
  # => "<a href="https://example.com">Some text</a>"

:reek:UtilityFunction

Parameters:

  • link_text (String)

    string to link

Returns:

  • (String)

    the link


24
25
26
27
28
29
30
# File 'lib/archangel/liquid/filters/link_to_filter.rb', line 24

def link_to(link_text, *args)
  link = args.first

  return link_text if link.blank?

  "<a href=\"#{link}\">#{link_text}</a>"
end