Add option to add a hidpi version of the logo

This commit is contained in:
Nick White 2020-01-31 16:34:57 +00:00
parent ab295db12c
commit cc215204f6
2 changed files with 8 additions and 3 deletions

View File

@ -141,11 +141,12 @@ If you add a key of `show_reading_time` true to either the Config Params, a page
### Logo
You can replace the title of your site in the top left corner of each page with your own logo. To do that put your own logo into the `static` directory of your website, and add the `logo` parameter to the site params in your config file. For example:
You can replace the title of your site in the top left corner of each page with your own logo. To do that put your own logo into the `static` directory of your website, and add the `logo` parameter to the site params in your config file. You can optionally add a HiDPI version of the logo, too. For example:
```
[params]
logo = "img/logo.svg"
logo = "img/logo.png"
logohidpi = "img/logohidpi.png"
```

View File

@ -2,7 +2,11 @@
<div class="flex-l justify-between items-center center">
<a href="{{ .Site.BaseURL }}" class="f3 fw2 hover-white no-underline white-90 dib">
{{ if .Site.Params.Logo }}
<img src="/{{ .Site.Params.Logo }}" alt="{{ .Site.Title }}" />
{{ if .Site.Params.LogoHidpi }}
<img srcset="{{ .Site.Params.LogoHidpi | relURL }} 2x, {{ .Site.Params.Logo | relURL }} 1x" src="{{ .Site.Params.Logo | relURL }}" alt="{{ .Site.Title }}" />
{{ else }}
<img src="{{ .Site.Params.Logo | relURL }}" alt="{{ .Site.Title }}" />
{{ end }}
{{ else }}
{{ .Site.Title }}
{{ end }}