diff options
author | Yue Yang <g1enyy0ung@gmail.com> | 2021-08-19 09:02:05 +0300 |
---|---|---|
committer | Yue Yang <g1enyy0ung@gmail.com> | 2021-08-19 09:02:05 +0300 |
commit | 210ea968117c9c306704fd9a551f33bc5b923dd4 (patch) | |
tree | ba553836d9ad953381ec8f74aab2783708a2215f | |
parent | 13341ca7921d328c06fb7cb6167ff58120e09e64 (diff) |
Render socials from data
-rw-r--r-- | docs/params-configurations.md | 6 | ||||
-rw-r--r-- | layouts/partials/socials.html | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/docs/params-configurations.md b/docs/params-configurations.md index 4778566..7d87160 100644 --- a/docs/params-configurations.md +++ b/docs/params-configurations.md @@ -215,6 +215,10 @@ View <https://valine.js.org/en/quickstart> to get more details. ### Social Links +> Deprecated. **Now you can do the rendering of socials with a custom data file. This file must be named `socials.toml` and must contain the array named `socials`.** +> +> Example: <https://github.com/g1eny0ung/blog/blob/master/data/socials.toml>. + `email = "g1enyy0ung@gmail.com"`<br /> `twitter = "g1eny0ung"`<br /> `facebook = "g1eny0ung"`<br /> @@ -225,7 +229,7 @@ View <https://valine.js.org/en/quickstart> to get more details. `stackoverflow = "5676489/g1eny0ung"`<br /> `codepen = "g1eny0ung"` -All of these social links will be showed on about page `layouts/partials/back.html` and header `layouts/partials/header.html`. +All of these social links will be showed on about page `layouts/partials/back.html`. You can open an issue or pull a request to add a social link. diff --git a/layouts/partials/socials.html b/layouts/partials/socials.html index 2c73636..948b0ac 100644 --- a/layouts/partials/socials.html +++ b/layouts/partials/socials.html @@ -58,4 +58,13 @@ <i class="{{ .IconSize }} codepen icon" title="Codepen"></i> </a> {{ end }} + + {{ if (fileExists "data/socials.toml") }} + {{ $iconSize := .IconSize }} + {{ range .Site.Data.socials.socials }} + <a class="item" href="{{ .href }}" target="{{ .target }}"> + <i class="{{ $iconSize }} {{ .icon }} icon" title="{{ .title }}"></i> + </a> + {{ end }} + {{ end }} </nav> |