feat(social): improve social links (#254)

* replace forkawesome and iconfont with simple icons
* add more configs for social
This commit is contained in:
Dillon
2020-04-24 19:04:37 +08:00
committed by GitHub
parent 87fbb05e86
commit c2197b7411
1337 changed files with 2369 additions and 6898 deletions

View File

@@ -1,25 +1,17 @@
{{- $type := .type | default "fa" -}}
{{- $classList := split .class " " -}}
{{- /* Fork Awesome */ -}}
{{- if eq $type "fo" -}}
{{- $newClassList := slice -}}
{{- range $classList -}}
{{- if eq . "fa" -}}
{{- $newClassList = $newClassList | append "fo" -}}
{{- else -}}
{{- $newClassList = $newClassList | append (replaceRE `^fa\-(.+)$` `fo-$1` .) -}}
{{- with .class -}}
<i class="{{ . }}"></i>
{{- else -}}
{{- $src := .src -}}
{{- with .simpleicons -}}
{{- $prefix := "lib/simple-icons/icons" -}}
{{- with $.prefix -}}
{{- $prefix = . -}}
{{- end -}}
{{- $prefix = $prefix | strings.TrimSuffix "/" -}}
{{- $src = printf "%s/%s.svg" $prefix . -}}
{{- end -}}
{{- $classList = $newClassList -}}
{{- with .scratch -}}
{{- dict "forkawesome" true | merge (.Get "this") | .Set "this" -}}
{{- end -}}
{{- /* default is Font Awesome */ -}}
{{- /* Others */ -}}
{{- else if ne $type "fa" -}}
{{- with .scratch -}}
{{- dict "iconfont" true | merge (.Get "this") | .Set "this" -}}
{{- if (urls.Parse $src).Host | not -}}
{{- $src = (resources.Get $src | minify).RelPermalink -}}
{{- end -}}
<i data-svg-src="{{ $src }}"></i>
{{- end -}}
<i class="{{ delimit $classList ` ` }}"></i>