Skip to content

Commit

Permalink
feat: add the links template for rendering a set of social links (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Apr 30, 2024
1 parent bcf6870 commit 5379767
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions layouts/partials/hb/modules/socials/links.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- $media := slice }}
{{- if reflect.IsMap .Media }}
{{- range $name, $id := .Media }}
{{- if hasPrefix $name "_" }}
{{- continue }}
{{- end }}
{{- $media = $media | append (dict "name" $name "id" $id) }}
{{- end }}
{{- else }}
{{- $media = .Media }}
{{- end }}
{{- $wrapperTag := .WrapperTag }}
{{- $opts := default dict .Options }}
{{- range $media }}
{{- with $wrapperTag }}
{{- printf `<%s class="%s">` . (default "" $.WrapperClass) | safeHTML }}
{{- end }}
{{- $ctx := merge $opts . }}
{{- partial "hb/modules/socials/link" $ctx }}
{{- with $wrapperTag }}
{{- printf "</%s>" . | safeHTML }}
{{- end }}
{{- end }}

0 comments on commit 5379767

Please sign in to comment.