Skip to content

Commit 30c3d9f

Browse files
committed
feat: allow favicon to be specified in text format
1 parent 5aabf7e commit 30c3d9f

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

docs/pages/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111

1212
- Remove author display if both post author and site author are not set [#354](https://github.com/g1eny0ung/hugo-theme-dream/pull/354)
1313
- Prioritize page descriptions over page summaries [#356](https://github.com/g1eny0ung/hugo-theme-dream/pull/356)
14+
- Allow favicon to be specified in text format
1415

1516
## [3.10.0] - 2025-01-07
1617

docs/pages/params-configurations.mdx

+9-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,15 @@ site footer.
199199

200200
### favicon
201201

202-
Custom the [favicon](https://en.wikipedia.org/wiki/Favicon), place it in the `static` folder.
202+
Custom the [favicon](https://en.wikipedia.org/wiki/Favicon) of your site, place it in the `static` folder.
203+
204+
<Callout type="info">
205+
You can also specify the favicon in text format (starting with `<link`), for example:
206+
207+
```html
208+
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%2210 0 100 100%22><text y=%22.90em%22 font-size=%2290%22>🌱</text></svg>"></link>
209+
```
210+
</Callout>
203211

204212
### customSyntaxHighlighting
205213

layouts/partials/head.html

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
{{ if isset site.Params "favicon" }}
2-
<link href="{{ site.Params.favicon | relURL }}" rel="icon" type="image/x-icon" />
1+
{{ with site.Params.favicon }}
2+
{{ if hasPrefix . "<link" }}
3+
{{ . | safeHTML }}
4+
{{ else }}
5+
<link href="{{ . | relURL }}" rel="icon" type="image/x-icon" />
6+
{{ end }}
37
{{ end }}
48

59
<link rel="canonical" href="{{ .Permalink }}" />

0 commit comments

Comments
 (0)