summaryrefslogtreecommitdiff
path: root/templates/partials/hcard.html
blob: 6479da6ed067b3c56af6e661df5a2d7eaea47551 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{%- set hcard = config.extra.hcard -%}

{% set full_name = config.author %}
{% if hcard.full_name %}
  {% set full_name = hcard.full_name %}
{% endif %}

{%- set homepage = config.base_url -%}
{% if hcard.homepage %}
  {%- set homepage = hcard.homepage -%}
{% endif %}

{% if hcard.enable %}
<div class="h-card hidden">
  <div>
    {%- if hcard.avatar -%}
    <img
      class="u-photo"
      src="{{ get_url(path=hcard.avatar, cachebust=true) }}"
      width="200"
      height="200"
      alt="{{ full_name }}"
    />
    {%- endif -%}

    <span class="p-name" rel="me">{{ full_name }}</span>

    {% if hcard.p_nickname %}
    ( <span class="p-nickname">{{ hcard.p_nickname }}</span> )
    {% endif %}
  </div>

  {% if hcard.biography %}
  <p class="p-note">{{ hcard.biography }}</p>
  {% endif %}

  {# links #}
  <div>
    {%- if hcard.with_mail and config.extra.email and not config.extra.encode_plaintext_email -%}
    <span>
      <a class="u-email" href="mailto:{{ config.extra.email | safe }}">email</a>
    </span> -
    {%- endif -%}

    <span>
      <a class="u-url u-id" href="{{ homepage }}">homepage</a>
    </span> -

    {%- if hcard.with_social_links and config.extra.socials %}
      {% for social in config.extra.socials %}
      <span>
        <a class="p-url" rel="me" href="{{ social.url | safe }}">{{ social.name }}</a>
      </span> -
      {% endfor %}
    {% endif %}
  </div>

  {# additional properties #}
  {% set dl_started = false %}
  {% for key, value in hcard %}
    {% if key not in ['enable', 'with_mail', 'with_social_links', 'homepage', 'full_name', 'avatar', 'biography', 'p_nickname'] %}
      {% if not dl_started %}
        <dl>
        {% set_global dl_started = true %}
      {% endif %}
      <dt>{{ key | replace(from="p_", to="") | replace(from="u_", to="") | replace(from="dt_", to="") | replace(from="_", to=" ") | capitalize }}</dt>
      <dd class="{{ key | replace(from="_", to="-") }}">{{ value }}</dd>
    {% endif %}
  {% endfor %}
  {% if dl_started %}
    </dl>
  {% endif %}

  </div>
{% endif %}