MyNixOS website logo
Description

Generate favicons for Hakyll websites.

Generate favicons for Hakyll websites

hakyll-favicon Build Status

This library allows you to easily add favicons to your hakyll website. You provide one SVG image and the library will convert it to different resolutions and generate the corresponding html.

Dependencies

This library depends on ImageMagick to convert the images.

Usage

First, add a faviconsRules that points to your main favicon in your Site.hs file like this:

main = hakyll $ do
  faviconsRules "images/favicon.svg" -- path to your favicon
  ...

Second, add a favicons field in your template head:

<head>
  ...
  $favicons$
</head>

Finally add the favicons context to your template context:

main = hakyll $ do
  ...
  match "index.html" $ do
    ...
    let ctx = ... `mappend`
              ... `mappend`
              faviconsField `mappend` -- add this
              defaultContext
    ...

The example directory provides a minimal working example of this.

Example

First, build the example:

stack build

Then build the example page:

stack exec example build

Or you can start a local server to serve the generated page:

stack exec example watch

Generated favicons

The following favicons are generated:

targetformatsizesdescription
all.ico32, 64basic favicon
all.png32basic favicon
iOS.png144third-generation iPad with high-resolution Retina display
iOS.png114iPhone with high-resolution Retina display
iOS.png72first- and second-generation iPad
iOS, Android.png57non-Retina iPhone, iPod Touch, and Android 2.1+ devices.
Metadata

Version

0.1.0

Executables (1)

  • bin/example

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows