Skip to content

Commit

Permalink
feat(social-links): allow specifying full URL
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jul 28, 2022
1 parent ccedd3a commit 7597e67
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions exampleSite/content/docs/widgets/social-links/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ github = "githubusername"

## Platforms

> The value can be changed to a full URL if necessary.
| Platform | User Identifier |
|---|---|
| `email` | Email Address |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ github = "githubusername"

## 平台

> 如有必要,值可以改为一个完整的 URL。
| 平台 | 用户标识 |
|---|---|
| `email` | 电子邮箱 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ github = "githubusername"

## 平臺

> 如有必要,值可以改為一個完整的 URL。
| 平臺 | 使用者標識 |
|---|---|
| `email` | 電子郵箱 |
Expand Down
5 changes: 4 additions & 1 deletion layouts/partials/helpers/social-links.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@
</a>
{{- else }}
{{- with index $items $key }}
<a class="nav-link social-link{{ with $linkClass }} {{ . }}{{ end }}" target="_blank" href="{{ printf .url $user }}" title="{{ default (title $key) .title }}" rel="noopener noreferrer">
{{- $link := printf .url $user }}
{{- $url := urls.Parse $user }}
{{- if $url.Scheme }}{{ $link = $url.String }}{{ end }}
<a class="nav-link social-link{{ with $linkClass }} {{ . }}{{ end }}" target="_blank" href="{{ $link }}" title="{{ default (title $key) .title }}" rel="noopener noreferrer">
<i class="fa-fw{{ with $size }} {{ . }}{{ end }} {{ default ( printf "fab fa-%s" $key ) .icon }}"></i>
{{- if $iconText }}
<span{{ with $iconTextClass }} class="{{ . }}"{{ end }}>{{ default (title $key) .title }}</span>
Expand Down

0 comments on commit 7597e67

Please sign in to comment.