-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathperson-image.html
44 lines (36 loc) · 1.18 KB
/
person-image.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{% assign person = include.person %}
{% comment %}
Usage: {% include person-image.html person=person %}
Sizing of the SVG is done in a viewBox, and it's resized later in CSS.
text-decoration hack is for Safari. We don't SVGs to be underlined.
{% endcomment %}
{% if person.image %}
{% capture image %}
<img class="rounded-circle profile"
alt="{{ person.display_name }}"
title="{{ person.display_name }}"
src="{{ site.baseurl }}/{{ person.image }}">
{% endcapture %}
{% else %}
{% capture image %}
<svg class="profile noprofile"
alt="{{ person.display_name }}"
viewBox="0 0 100 100">
<title>{{ person.display_name }}</title>
<circle r="50" cx="50" cy="50" />
<text x="50" y="50"
font-size="70"
text-anchor="middle" dominant-baseline="central" >
{{ person.display_name | slice: 0 }}
</text>
</svg>
{% endcapture %}
{% endif %}
{% if person.webpage %}
<a href="{{ person.webpage | escape }}"
style="text-decoration: none">
{{ image }}
</a>
{% else %}
{{ image }}
{% endif %}