Kotlin / kotlinx.html

Kotlin DSL for HTML
Apache License 2.0
1.63k stars 133 forks source link

link missing attribute sizes #109

Closed landsman closed 6 months ago

landsman commented 5 years ago

I need specify sizes attribute for favicons:

    <link rel="apple-touch-icon" sizes="57x57" href="%PUBLIC_URL%/img/apple-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="%PUBLIC_URL%/img/apple-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="%PUBLIC_URL%/img/apple-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="%PUBLIC_URL%/img/apple-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="%PUBLIC_URL%/img/apple-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="%PUBLIC_URL%/img/apple-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="%PUBLIC_URL%/img/apple-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="%PUBLIC_URL%/img/apple-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/img/apple-icon-180x180.png">
    <link rel="icon" type="image/png" sizes="192x192"  href="%PUBLIC_URL%/img/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/img/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="96x96" href="%PUBLIC_URL%/img/favicon-96x96.png">
    <link rel="icon" type="image/png" sizes="16x16" href="%PUBLIC_URL%/img/favicon-16x16.png">
    <link rel="manifest" href="%PUBLIC_URL%/img/manifest.json">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="%PUBLIC_URL%/img/ms-icon-144x144.png">
    <meta name="theme-color" content="#009b77">
alexvas commented 4 years ago

The workaround would be

link(rel="...", href="...") {
  attributes["sizes"]="57x57"
}
severn-everett commented 6 months ago

You don't need to access the attributes map, the sizes attribute can be configured directly within the block of the declared tag, e.g.

link(rel="icon", type="image/png", href="%PUBLIC_URL%/img/android-icon-192x192.png") {
    sizes = "192x192"
}
landsman commented 6 months ago

all right, thanks!