Skip to content

Commit

Permalink
Merge pull request #3 from andreadistefano/fix_favicon-example-site
Browse files Browse the repository at this point in the history
fix: use default favicon in custom site
  • Loading branch information
andreadistefano authored Oct 23, 2024
2 parents a4097e7 + a015588 commit e1f5d4d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,16 @@ git submodule update --remote --merge

### 🎨 Favicon

Create `[SITEROOT]/layouts/partials/favicon.html` to override theme's favicon.
In `config.toml`:

If you want to use a simple emoji favicon, just copy the following code to your `favicon.html`:
```toml
[params]
replaceFavicon = true
```

Then, create `[SITEROOT]/layouts/partials/custom_favicon.html` to override the theme's default favicon.

If you want to use a simple emoji favicon, just copy the following code to your `custom_favicon.html`:

```html
<link
Expand All @@ -73,9 +80,8 @@ If you want to use a simple emoji favicon, just copy the following code to your
```
See `layouts/partials/favicon.html` for an example.

Otherwise, you can provide your favicon, or generate it using an online service, for example [realfavicongenerator.net](https://realfavicongenerator.net/). \
See `exampleSite/layouts/partials/favicon.html` and `exampleSite\static\assets\favicon` for an example.

Otherwise, you can provide your own favicon or generate it using an online service, for example [realfavicongenerator.net](https://realfavicongenerator.net/). \
See `exampleSite/layouts/partials/custom_favicon.html` and `exampleSite/static/assets/favicon` for an example.

### ❌ License, toc and comments

Expand Down
3 changes: 3 additions & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ summaryLength = 100 # Custom summary length, add <!--more--> in post file to cus
# Copyright
copyrightStartYear = "2024"

# favicon
replaceFavicon = false

# Open Graph & Twitter Card variables
# You can also set description and images in post front matter individually
description = "A minimal Hugo theme with nice theme color."
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
{{ hugo.Generator }}

<!-- favicon -->
{{ if .Site.Params.replaceFavicon }}
{{ partial "custom_favicon.html" . }}
{{ else }}
{{ partial "favicon.html" . }}
{{ end }}
<!-- seo metadata -->
{{ if and (.IsHome) (.Site.Params.subTitle) }}
<title>{{ .Site.Title }} - {{ .Site.Params.subTitle }}</title>
Expand Down

0 comments on commit e1f5d4d

Please sign in to comment.