Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the option to use a logo for the top left site title #249

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ For example, if your css files are `static/css/custom.css` and `static/css/custo
If you add a key of `show_reading_time` true to either the Config Params, a page or section's front matter, articles will show the reading time and word count.


### 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:

```
[params]
logo = "img/logo.svg"
```


### Nearly finished

In order to see your site in action, run Hugo's built-in local server.
Expand Down
4 changes: 4 additions & 0 deletions layouts/partials/site-navigation.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<nav class="pv3 ph3 ph4-ns" role="navigation">
<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 }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Using with would make this a tiny bit less verbose (still for best practices promoting):

{{ with .Site.Params.Logo }}
  <img src="{{ relURL . }}" alt="{{ $.Site.Title }}" />
{{ else }}
   {{ .Site.Title }}
{{ end }}

<img src="{{ .Site.Params.Logo | relURL }}" alt="{{ .Site.Title }}" />
{{ else }}
{{ .Site.Title }}
{{ end }}
</a>
<div class="flex-l items-center">
{{ partial "i18nlist.html" . }}
Expand Down