add custom urls for predefined social icons #120
This commit is contained in:
parent
e1d08892de
commit
10c340b011
17
README.md
17
README.md
@ -19,7 +19,7 @@ Anubis is a simple minimalist theme for [Hugo blog engine](https://gohugo.io/).
|
|||||||
- Disqus
|
- Disqus
|
||||||
- Utteranc.es
|
- Utteranc.es
|
||||||
- RSS feeds
|
- RSS feeds
|
||||||
* Hiding posts from the RSS feed
|
- Hiding posts from the RSS feed
|
||||||
- Translations (en, ru, fr, pl)
|
- Translations (en, ru, fr, pl)
|
||||||
- Custom CSS/JS
|
- Custom CSS/JS
|
||||||
- Multilingual mode
|
- Multilingual mode
|
||||||
@ -153,10 +153,23 @@ Example:
|
|||||||
```
|
```
|
||||||
Config like this generate github icon with "https://github.com/gohugoio" url.
|
Config like this generate github icon with "https://github.com/gohugoio" url.
|
||||||
|
|
||||||
|
#### Predefined icons with custom url
|
||||||
|
To add prefedined icon with custom url, add to `params.social` config:
|
||||||
|
- id of social network
|
||||||
|
- full url to your network
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
- id: github
|
||||||
|
url: "https://github.com/gohugoio/hugo"
|
||||||
|
```
|
||||||
|
Config like this generate github icon with "https://github.com/gohugoio/hugo" url.
|
||||||
|
|
||||||
#### Custom icons
|
#### Custom icons
|
||||||
To add custom icon, add to `params.social` config:
|
To add custom icon, add to `params.social` config:
|
||||||
- id of social network/site
|
- id of social network/site
|
||||||
- full url to your network/site
|
- full url to your network/site
|
||||||
|
|
||||||
Also you need to create directory `static/fa-icons` and add svg icon of your network/site with name equals to `id` from config.
|
Also you need to create directory `static/fa-icons` and add svg icon of your network/site with name equals to `id` from config.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
@ -28,6 +28,10 @@ utterancesLabel = "" # optional
|
|||||||
id = "docs"
|
id = "docs"
|
||||||
url = "https://gohugo.io/documentation/"
|
url = "https://gohugo.io/documentation/"
|
||||||
|
|
||||||
|
[[params.social]]
|
||||||
|
id = "github"
|
||||||
|
url = "https://github.com/mitrichius/hugo-theme-anubis"
|
||||||
|
|
||||||
[menu]
|
[menu]
|
||||||
|
|
||||||
[[menu.main]]
|
[[menu.main]]
|
||||||
|
@ -29,6 +29,10 @@ utterancesLabel = "" # optional
|
|||||||
id = "docs"
|
id = "docs"
|
||||||
url = "https://gohugo.io/documentation/"
|
url = "https://gohugo.io/documentation/"
|
||||||
|
|
||||||
|
[[params.social]]
|
||||||
|
id = "github"
|
||||||
|
url = "https://github.com/mitrichius/hugo-theme-anubis"
|
||||||
|
|
||||||
[languages.en]
|
[languages.en]
|
||||||
languageName = "English"
|
languageName = "English"
|
||||||
|
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
<ul class="social-icons">
|
<ul class="social-icons">
|
||||||
|
|
||||||
{{ range $.Site.Params.Social }}
|
{{ range $.Site.Params.Social }}
|
||||||
{{ if and (isset $.Site.Data.social.social_icons .id) (isset . "name") }}
|
{{ if and (isset $.Site.Data.social.social_icons .id) (isset . "url") }}
|
||||||
|
<li>
|
||||||
|
<a {{ printf "href=%q" .url | safeHTMLAttr }} title="{{ humanize .id }}" rel="me">
|
||||||
|
{{ partial "font-awesome.html" (dict "iconName" .id "custom" false) }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{ else if and (isset $.Site.Data.social.social_icons .id) (isset . "name") }}
|
||||||
{{ $url := index $.Site.Data.social.social_icons .id }}
|
{{ $url := index $.Site.Data.social.social_icons .id }}
|
||||||
{{ $ref := printf $url .name }}
|
{{ $ref := printf $url .name }}
|
||||||
<li>
|
<li>
|
||||||
|
Loading…
Reference in New Issue
Block a user