Skip to content

Commit

Permalink
fix(social): replace site.Social with site.Params.social (#1002)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Oct 31, 2023
1 parent 73a8e61 commit 5b2e093
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 45 deletions.
38 changes: 38 additions & 0 deletions exampleSite/config/_default/params.toml
Expand Up @@ -295,3 +295,41 @@ expand = false # Expand docs navigations.

[feeds]
# content = true

[social]
email = "user@domain.tld"
# facebook = "yourfacebookusername"
github = "razonyang/hugo-theme-bootstrap"
# gitlab = "yourgitlabusername"
# linkedin = "yourlinkedinusername"
# xing = "yourxingusername"
# stackoverflow = "yourstackoverflowuserid"
twitter = "razonyang"
# weibo = "yourweibousername"
# zhihu = "yourzhihuusername"
# instagram = "yourinstagramusername"
# itchio = "youritchiousername"
# quora = "yourquorausername"
# tumblr = "yourtumblrusername"
# reddit = "yourredditusername"
# telegram = "yourtelegramusername"
# qq = "yourqqnumber"
# dockerhub = "yourdockerhubusername"
# bitbucket = "yourbitbucketworkspaceid"
# kaggle = "yourkaggleusername"
# medium = "yourmediumusername" # Medium username or custom domain(e.g. https://razonyang.com).
# lastfm = "yourlastfmusername"
# bilibili = "yourbilibiliuserid"
# youtube = "youryoutubechannelid"
# discord = "yourdiscordinvitecode"
# discourse = "https://yourforum.tld"
# facebookgroup = "yourfacebookgroupname"
# tiktok = "yourtiktokusername"
# artstation = "yourartstationusername"
# pinterest = "yourpinterestusername"
# mastodon = "yourmastodonusername"
# liberapay = "yourliberapayaccount"
paypal="razonyang"
patreon="razonyang"
# tipeee="yourtipeeeaccount-fr"
# rss = "" # Disable RSS link
36 changes: 0 additions & 36 deletions exampleSite/config/_default/social.toml

This file was deleted.

Expand Up @@ -72,6 +72,7 @@ The site parameters are located in `config/_default/params.toml` by default.
| `fontSize.extraSmall` | String | `.8rem` | Extra small font size.
| `fontSize.large` | String | `1.1rem` | Large font size.
| `fontSize.extraLarge` | String | `1.2rem` | Extra large font size.
| `social` | Object | - | [Social Links]({{< ref "/docs/widgets/social-links" >}}).
| `socialShare` | Boolean | `true` | Turn on/off built-on social share button.
| `searchBar` | Boolean | `true` | Turn on/off built-on search bar.
| `archive` | Object | - | [Archive]({{< ref "/docs/layouts/archives" >}}).
Expand Down
Expand Up @@ -73,6 +73,7 @@ authors = ["RazonYang"]
| `fontSize.extraSmall` | String | `.8rem` | 更小的字体
| `fontSize.large` | String | `1.1rem` | 大字体
| `fontSize.extraLarge` | String | `1.2rem` | 更大的字体
| `social` | Object | - | [社交链接]({{< ref "/docs/widgets/social-links" >}})。
| `socialShare` | Boolean | `true` | 启用/禁用内置的分享按钮
| `searchBar` | Boolean | `true` | 启用/禁用搜索栏
| **Archive**
Expand Down
Expand Up @@ -73,6 +73,7 @@ authors = ["RazonYang"]
| `fontSize.extraSmall` | String | `.8rem` | 更小的字體
| `fontSize.large` | String | `1.1rem` | 大字體
| `fontSize.extraLarge` | String | `1.2rem` | 更大的字體
| `social` | Object | - | [社交鏈接]({{< ref "/docs/widgets/social-links" >}})。
| `socialShare` | Boolean | `true` | 啟用/禁用內置的分享按鈕
| `searchBar` | Boolean | `true` | 啟用/禁用搜索欄
| **Archive**
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/docs/configuration/site/index.md
Expand Up @@ -35,7 +35,6 @@ The site configuration is located in `config/_default/config.toml` by default.
| `enableRobotsTXT` | Boolean | `true` |
| `disqusShortname` | String | - | [Disqus]({{< ref "/docs/widgets/comments#disqus" >}}) shortname.
| `googleAnalytics` | String | - | Google Analytics, both of universal analytics and GA4 are supported.
| `social` | Object | - | [Social Links]({{< ref "/docs/widgets/social-links" >}}).
| `author` | Object | - | [Author Widget]({{< ref "/docs/widgets/author" >}}).

See also [All Configuration Settings](https://gohugo.io/getting-started/configuration/#all-configuration-settings).
Expand Up @@ -35,7 +35,6 @@ authors = ["RazonYang"]
| `enableRobotsTXT` | Boolean | `true` |
| `disqusShortname` | String | - | [Disqus]({{< ref "/docs/widgets/comments#disqus" >}}) shortname。
| `googleAnalytics` | String | - | Google Analytics, both of universal analytics and GA4 are supported.
| `social` | Object | - | [社交链接]({{< ref "/docs/widgets/social-links" >}})。
| `author` | Object | - | [作者小部件]({{< ref "/docs/widgets/author" >}})。

请参阅 [All Configuration Settings](https://gohugo.io/getting-started/configuration/#all-configuration-settings)
Expand Up @@ -35,7 +35,6 @@ authors = ["RazonYang"]
| `enableRobotsTXT` | Boolean | `true` |
| `disqusShortname` | String | - | [Disqus]({{< ref "/docs/widgets/comments#disqus" >}}) shortname。
| `googleAnalytics` | String | - | Google Analytics, both of universal analytics and GA4 are supported.
| `social` | Object | - | [社交鏈接]({{< ref "/docs/widgets/social-links" >}})。
| `author` | Object | - | [作者小部件]({{< ref "/docs/widgets/author" >}})。

請參閱 [All Configuration Settings](https://gohugo.io/getting-started/configuration/#all-configuration-settings)
3 changes: 2 additions & 1 deletion exampleSite/content/docs/widgets/social-links/index.md
Expand Up @@ -50,9 +50,10 @@ Set up social links by editing a file `config/_default/author.toml` with the fol

### Footer

Set up social links by creating a file `config/_default/social.toml` with the following content:
Set up social links by putting the following content in `config/_default/params.toml`.

```toml
[social]
email = "user@domain.tld"
github = "githubusername"
```
Expand Down
Expand Up @@ -50,9 +50,10 @@ authors = ["RazonYang"]

### 页脚

创建 `config/_default/social.toml` 文件,并填写以下配置
将以下内容放到 `config/_default/params.toml` 文件,以于页脚设置社交链接

```toml
[social]
email = "user@domain.tld"
github = "githubusername"
```
Expand Down
Expand Up @@ -50,9 +50,10 @@ authors = ["RazonYang"]

### 頁腳

建立 `config/_default/social.toml` 檔案,並填寫以下配置
將以下內容放到 `config/_default/params.toml` 文件,以於頁腳設置社交鏈接

```toml
[social]
email = "user@domain.tld"
github = "githubusername"
```
Expand Down Expand Up @@ -96,5 +97,5 @@ github = "githubusername"
| `paypal` | Paypal 使用者名稱 |
| `patreon` | Patreon 使用者名稱 |
| `tipeee` | Tipeee 使用者名稱 |
| `rss` | 空字符串以禁用 RSS 链接 |
| `rss` | 空字符串以禁用 RSS 鏈接 |
| `website` | 網站 URL |
Expand Up @@ -13,7 +13,6 @@
│ ├── params.zh-hans.toml
│ ├── params.zh-hant.toml
│ ├── server.toml
│ └── social.toml
└── production
├── config.toml
└── params.toml
Expand Down
9 changes: 8 additions & 1 deletion layouts/partials/footer/social-links.html
@@ -1,5 +1,12 @@
{{- $social := default dict site.Params.social }}
{{- if not $social }}
{{- with site.Social }}
{{- warnf "The social configuration and the social key in site configuration are deprecated. Use params.social instead." }}
{{- $social = . }}
{{- end }}
{{- end }}
{{- partial "helpers/social-links" (dict
"links" .Site.Social
"links" $social
"size" (cond (isset .Site.Menus "footer") "" "fa-2x")
"class" (cond (isset .Site.Menus "footer") "justify-content-between mb-2 mt-3" "mb-2 mt-3")
"linkClass" "p-0 me-1 mb-2"
Expand Down

0 comments on commit 5b2e093

Please sign in to comment.