diff --git a/README.md b/README.md index e30ea06..eb369c9 100644 --- a/README.md +++ b/README.md @@ -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 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." diff --git a/exampleSite/layouts/partials/favicon.html b/exampleSite/layouts/partials/custom_favicon.html similarity index 100% rename from exampleSite/layouts/partials/favicon.html rename to exampleSite/layouts/partials/custom_favicon.html diff --git a/layouts/partials/head.html b/layouts/partials/head.html index e00b238..f12207f 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -8,7 +8,11 @@ {{ hugo.Generator }} +{{ if .Site.Params.replaceFavicon }} +{{ partial "custom_favicon.html" . }} +{{ else }} {{ partial "favicon.html" . }} +{{ end }} {{ if and (.IsHome) (.Site.Params.subTitle) }} {{ .Site.Title }} - {{ .Site.Params.subTitle }}