Improve favicon meta tags, support realfavicongenerator.

This commit is contained in:
Fredrik Jonsson 2019-05-30 23:27:53 +02:00
commit fea098e8f1
2 changed files with 15 additions and 1 deletions

View file

@ -159,10 +159,13 @@ params:
piwikSiteId: # Matamo site id
piwikTrackerUrl: "" # Matamo url, schemaless and no slash on end (example.org/matamo).
poweredby: true # Show powered by hugo in footer
realfavicongenerator: # If full set of favicons, site manifest etc. exists, default false.
safariPinnedColor: # Hex color value, used in meta tags, default "#000000".
search: true # Site search with DuckDuckGo.
searchSize: 20 # Search field size, default 20.
sidebar: true # Show a sidebar to the right
submitted: true # Show author and date information for a post.
themeColor: # Hex color value, used in meta tags, default "#ffffff".
podcast:
title: # * Feed title, defaults to site title (iTunes).
@ -190,6 +193,7 @@ The site will work without setting any of the podcast parameters but your podcas
## Customise
### Logo
Place your logo at `static/images/logo.png`. If you don't provide a logo, then the default theme logo will be used.
@ -199,6 +203,8 @@ Place your logo at `static/images/logo.png`. If you don't provide a logo, then t
Upload your image to [RealFaviconGenerator](https://realfavicongenerator.net/) then copy-paste the generated favicon files under `static`.
Then set the "realfavicongenerator" param to true to add the needed meta tags. Also good to set the "themeColor" and "safariPinnedColor" params to correct colours.
### Layouts

View file

@ -1,6 +1,14 @@
{{ .Hugo.Generator }}
{{ with $.Param "contact" }}<meta name="contact" content="{{ . }}">{{ end }}
<meta name="msapplication-TileColor" content="{{ $.Param "themecolor" | default "#ffffff" }}">
<meta name="theme-color" content="{{ $.Param "themecolor" | default "#ffffff" }}">
{{ with .Site.Params.piwikTrackerUrl }}<link rel="dns-prefetch" href="//{{ . }}">{{ end }}
{{ with $.Param "microusername" }}<link rel="me" href="https://micro.blog/{{ . }}">{{ end }}
<link rel="canonical" href="{{ .Permalink }}">
<link rel="apple-touch-icon" href="{{ "/apple-touch-icon.png" | relURL }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | relURL }}">
{{ if $.Param "realfavicongenerator" -}}
<link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon-32x32.png" | relURL }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | relURL }}">
<link rel="mask-icon" href="{{ "safari-pinned-tab.svg" | relURL }}" color="{{ $.Param "safari-pinned-color" | default "#000000" }}">
<link rel="manifest" href="{{ "site.webmanifest" | relURL }}">
{{ end -}}