Skip to content

Commit

Permalink
fix: support Src in social.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
HEIGE-PCloud committed Mar 28, 2024
1 parent 69482cb commit 68e50e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion assets/data/social.yml
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ bilibili:
Prefix: https://space.bilibili.com/
Title: bilibili
Icon:
Simpleicons: bilibili
Src: svg/icons/bilibili.svg

# 063: ORCID
orcid:
Expand Down
13 changes: 8 additions & 5 deletions layouts/partials/plugin/icon.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
{{- partial "plugin/fontawesome.html" . -}}
{{- else -}}
{{- with .Simpleicons -}}
{{ partial "plugin/simpleicons.html" . }}
{{ partial "plugin/simpleicons.html" . }}
{{- else -}}
{{- with .Class -}}
{{- errorf "Deprecated %v" . -}}
{{- with .Src -}}
{{- $resource := resources.Get . -}}
{{ if not $resource }}
{{- errorf "Icon does not exist %v" . -}}
{{- end -}}
{{- end -}}
{{- end }}
{{- $resource := $resource.Content -}}
{{- $resource | replaceRE `<svg ` `<svg class="icon" ` | safeHTML -}} {{- end -}} {{- with .Class -}} {{-
errorf "Deprecated %v" . -}} {{- end -}} {{- end -}} {{- end }}

0 comments on commit 68e50e4

Please sign in to comment.