summaryrefslogtreecommitdiffstats
path: root/templates_html/page.html
blob: b4986fa9a637f6946311e496ff5622c800a61874 (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
{% extends "base.html" %}
{% import "macros.html" as macros %}
{% block content %}

<article class="h-entry">
{{ macros::page_content(page=page) }}
<span class="p-author h-card">
    <img class="u-photo" src="https://jan.systems/files/Jan_Tuomi_headshot.jpg" loading="lazy" style="display:none" />
    <a class="p-name u-url" href="https://jan.systems" style="display:none">Jan Sydänviita (né Tuomi)</a>
</span>
<a class="u-url" href="{{ page.permalink }}" hidden></a>
<time class="dt-published" datetime="{{ page.date }}" hidden></time>
{% if page.extra.wm_in_reply_to %}
<a class="u-in-reply-to" href="{{ page.extra.wm_in_reply_to }}" hidden></a>
{% endif %}

</article>

<div id="webmentions"></div>
<script>
fetch(`https://webmention.io/api/mentions.jf2?target={{ page.permalink | safe }}`)
  .then(res => res.json())
  .then(data => {
    const container = document.getElementById('webmentions');
    (data.children || []).forEach(entry => {
      const author = entry.author || {};
      const el = document.createElement('div');
      el.className = 'webmention webmention-' + (entry['wm-property'] || 'mention');
      el.innerHTML = `
        ${author.photo ? `<img src="${author.photo}" alt="" width="32" height="32">` : ''}
        <a href="${author.url || entry.url}">${author.name || 'Someone'}</a>
        ${entry.content ? `<p>${entry.content.text || ''}</p>` : ''}
      `;
      container.appendChild(el);
    });
  })
  .catch(err => console.error('Webmentions failed to load:', err));
</script>

<nav class="post-nav" aria-label="Post navigation">
    {% if page.higher %}
    <div class="post-nav-left">
        <a class="post-nav-link" href="{{ page.higher.permalink }}"
            >← {{ page.higher.title }}</a
        >
    </div>
    {% endif %} {% if page.lower %}
    <div class="post-nav-right">
        <a class="post-nav-link" href="{{ page.lower.permalink }}"
            >{{ page.lower.title }} →</a
        >
    </div>
    {% endif %}
</nav>
{% endblock %}