Site logo (#284)

* Add the option to use a logo for the top left site title
This commit is contained in:
Tanner Smith 2020-06-03 16:26:29 -05:00 committed by GitHub
parent 9752a70c09
commit 9171519154
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View file

@ -146,6 +146,16 @@ If you add a key of `show_reading_time` true to either the Config Params, a page
Some scripts need to be added within the page head. To add your own scripts to the page head, simply insert them into the `head-additions.html` partial located in the `layouts/partials` folder. Some scripts need to be added within the page head. To add your own scripts to the page head, simply insert them into the `head-additions.html` partial located in the `layouts/partials` folder.
### 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 `site_logo` parameter to the site params in your config file. For example:
```
[params]
site_logo = "img/logo.svg"
```
### Nearly finished ### Nearly finished
In order to see your site in action, run Hugo's built-in local server. In order to see your site in action, run Hugo's built-in local server.

View file

@ -18,6 +18,7 @@ enableRobotsTXT = true
[params] [params]
favicon = "" favicon = ""
site_logo = ""
description = "The last theme you'll ever need. Maybe." description = "The last theme you'll ever need. Maybe."
facebook = "" facebook = ""
twitter = "https://twitter.com/GoHugoIO" twitter = "https://twitter.com/GoHugoIO"

View file

@ -1,7 +1,11 @@
<nav class="pv3 ph3 ph4-ns" role="navigation"> <nav class="pv3 ph3 ph4-ns" role="navigation">
<div class="flex-l justify-between items-center center"> <div class="flex-l justify-between items-center center">
<a href="{{ .Site.Home.RelPermalink }}" class="f3 fw2 hover-white no-underline white-90 dib"> <a href="{{ .Site.Home.RelPermalink }}" class="f3 fw2 hover-white no-underline white-90 dib">
{{ with .Site.Params.site_logo }}
<img src="{{ . }}" class="w100 mw5-ns" alt="{{ $.Site.Title }}" />
{{ else }}
{{ .Site.Title }} {{ .Site.Title }}
{{ end }}
</a> </a>
<div class="flex-l items-center"> <div class="flex-l items-center">
{{ partial "i18nlist.html" . }} {{ partial "i18nlist.html" . }}