module LuckyFavicon::Tags

Defined in:

lucky_favicon/tags.cr

Constant Summary

FAVICON_ICON_SIZES = ["16x16", "32x32"] of ::String

Instance Method Summary

Instance Method Detail

def apple_touch_icon_tag(version : String? = nil, dir : String? = nil) : Nil #

Generates a apple-touch-icon link tag with a default size of 180x180:

<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=0.1.0">

Note: currently it only supports one icon with the fixed size of 180x180. This is also the default when generating the icon set.


[View source]
def application_name_tags(app_name : String) : Nil #

Generates meta tags for the application name:

<meta name="apple-mobile-web-app-title" content="Lucky App"> <meta name="application-name" content="Lucky App">


[View source]
def favicon_icon_path(icon : String, version : String? = nil, dir : String? = nil) #

Builds the path to the given file.


[View source]
def favicon_icon_tags(sizes : Array(String) = FAVICON_ICON_SIZES, version : String? = nil, dir : String? = nil) : Nil #

Generates the default .ico shortcut icon link tag and also a list for png favicon icons with a number of given sizes (most likely 16x16 and 32x32):

<link rel="shortcut icon" href="/favicon.ico?v=0.1.0"> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png?v=0.1.0"> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png?v=0.1.0">


[View source]
def favicon_tags(app_name : String, theme_color : String, version : String? = nil, dir : String? = nil) : Nil #

Generates a set of icon tags as suggested by https://realfavicongenerator.net/


[View source]
def safari_pinned_tab_tag(theme_color : String, version : String? = nil, dir : String? = nil) : Nil #

Generates a mask-icon link tag using the generated svg icon and the theme color for the backgound:

<link rel="mask-icon" href="/safari-pinned-tab.svg?v=0.1.0" color="#ff0066">


[View source]
def site_webmanifest_tag(version : String? = nil, dir : String? = nil) : Nil #

Generates a manifest link tag for the sit's web manifest:

<link rel="manifest" href="/site.webmanifest?v=0.1.0">


[View source]
def theme_color_tags(theme_color : String) #

Generates meta tags for the global theme color, mostly used as a background to the base icon:

<meta name="msapplication-TileColor" content="#ff0066"> <meta name="theme-color" content="#ff0066">


[View source]