Skip to content

Commit

Permalink
add authorURL property
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbepop committed May 25, 2024
1 parent 82f0058 commit b934b20
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ theme: PaperMod

params:
author: 'Robin Freyler'
# authorURL: 'https://github.com/robbepop'
homeInfoParams:
Title: 'Wasmi - WebAssembly Interpreter'
Content: 'News and information about the Wasmi WebAssembly interpreter'
Expand Down
20 changes: 20 additions & 0 deletions layouts/partials/author.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if or .Params.author site.Params.author }}
{{- $author := (.Params.author | default site.Params.author) }}
{{- $authorURL := (.Params.authorURL | default site.Params.authorURL) }}
{{- $author_type := (printf "%T" $author) }}
{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }}
{{- if $authorURL }}
{{- range $index, $element := $author }}
<a href="{{ $authorURL }}" target="_blank" rel="noopener">{{ $element }}</a>{{ if ne (add $index 1) (len $author) }}, {{ end }}
{{- end }}
{{- else }}
{{- delimit $author ", " }}
{{- end }}
{{- else }}
{{- if $authorURL }}
<a href="{{ $authorURL }}" target="_blank" rel="noopener">{{ $author }}</a>
{{- else }}
{{- $author }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit b934b20

Please sign in to comment.