Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(social-links): allow specifying full URL #628

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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