about widget: Allow for multiple organizations (Close #132)

- Remove `organization` and `organization_url` options from config
- Add `organizations = [ {name="Org Name", url=""} ]`
- Continue to support legacy options
- Only show `role` if it is set
This commit is contained in:
George Cushen 2017-09-30 22:50:58 +01:00
commit b031608ee4
2 changed files with 16 additions and 3 deletions

View file

@ -35,8 +35,11 @@ defaultContentLanguageInSubdir = false
# Your details.
name = "Lena Smith"
role = "Professor of Artificial Intelligence"
organization = "Stanford University"
organization_url = ""
# Organizations/Affiliations.
# Separate multiple entries with a comma, using the form: `[ {name="Org1", url=""}, {name="Org2", url=""} ]`.
organizations = [ { name = "Stanford University", url = "" } ]
gravatar = false # Get your avatar from Gravatar.com? (true/false)
avatar = "portrait.jpg" # Specify an avatar image (in `static/img/` folder) or delete value to disable avatar.
email = "test@example.org"

View file

@ -16,7 +16,9 @@
<div class="portrait-title">
<h2 itemprop="name">{{ $.Site.Params.name }}</h2>
<h3 itemprop="jobTitle">{{ $.Site.Params.role }}</h3>
{{ with $.Site.Params.role }}<h3 itemprop="jobTitle">{{ . }}</h3>{{ end }}
{{/* Support legacy `organization` option. */}}
{{ if $.Site.Params.organization }}
<h3 itemprop="worksFor" itemscope itemtype="http://schema.org/Organization">
{{ with $.Site.Params.organization_url }}<a href="{{ . }}" target="_blank" itemprop="url">{{ end }}
@ -24,6 +26,14 @@
{{ if $.Site.Params.organization_url }}</a>{{ end }}
</h3>
{{ end }}
{{ range $.Site.Params.organizations }}
<h3 itemprop="worksFor" itemscope itemtype="http://schema.org/Organization">
{{ with .url }}<a href="{{ . }}" target="_blank" itemprop="url">{{ end }}
<span itemprop="name">{{ .name }}</span>
{{ if .url }}</a>{{ end }}
</h3>
{{ end }}
</div>
<link itemprop="url" href="{{ $.Site.BaseURL }}">