Method: Padrino::Helpers::AssetTagHelpers#favicon_tag

Defined in:
padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb

#favicon_tag(source, options = {}) ⇒ String

Generates a favicon link. Looks inside images folder

Examples:

favicon_tag 'favicon.png'
favicon_tag 'icons/favicon.png'
# or override some options
favicon_tag 'favicon.png', :type => 'image/ico'

Parameters:

  • source (String)

    The source image path for the favicon link tag.

  • options (Hash) (defaults to: {})

    The html options for the favicon link tag.

Returns:

  • (String)

    The favicon link html tag with specified options.

[View source] [View on GitHub]

191
192
193
194
195
# File 'padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb', line 191

def favicon_tag(source, options={})
  type = File.extname(source).sub('.','')
  options = { :href => image_path(source), :rel => 'icon', :type => "image/#{type}" }.update(options)
  tag(:link, options)
end