diff options
| -rw-r--r-- | templates_gmi/shortcodes/html_only.html | 0 | ||||
| -rw-r--r-- | templates_html/base.html | 1 | ||||
| -rw-r--r-- | templates_html/page.html | 33 | ||||
| -rw-r--r-- | templates_html/shortcodes/html_only.html | 1 |
4 files changed, 30 insertions, 5 deletions
diff --git a/templates_gmi/shortcodes/html_only.html b/templates_gmi/shortcodes/html_only.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/templates_gmi/shortcodes/html_only.html diff --git a/templates_html/base.html b/templates_html/base.html index 26e5895..3a54f4f 100644 --- a/templates_html/base.html +++ b/templates_html/base.html @@ -83,6 +83,7 @@ /> <link rel="authorization_endpoint" href="https://indieauth.com/auth" /> + <link rel="webmention" href="https://webmention.io/jan.systems/webmention" /> </head> <body> <div class="header-row"> diff --git a/templates_html/page.html b/templates_html/page.html index 3aebb83..2d60db3 100644 --- a/templates_html/page.html +++ b/templates_html/page.html @@ -4,6 +4,27 @@ {{ macros::page_content(page=page) }} +<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"> @@ -21,17 +42,19 @@ </nav> <div style="display: none" class="h-entry"> - <div class="e-content p-name">{{ page.title }}</div> - <a rel="author" class="p-author h-card" href="https://jan.systems"> + <div class="p-name">{{ page.title }}</div> + <span class="p-author h-card"> <img class="u-photo" src="https://jan.systems/files/Jan_Tuomi_headshot.jpg" loading="lazy" /> - Jan Tuomi (né Tuomi) - </a> - <a class="u-url" href="https://jan.systems/{{ page.path }}"> + <a class="p-name u-url" href="https://jan.systems">Jan Sydänviita (né Tuomi)</a> + </span> + <a class="u-url" href="{{ page.permalink }}"> Published <time class="dt-published">{{ page.date }}</time> </a> + <p class="e-content">Testing, don't mind me</p> + <a class="u-in-reply-to" href="https://aaronparecki.com/2018/06/30/11/your-first-webmention">@aaronpk</a> </div> {% endblock %} diff --git a/templates_html/shortcodes/html_only.html b/templates_html/shortcodes/html_only.html new file mode 100644 index 0000000..32cb472 --- /dev/null +++ b/templates_html/shortcodes/html_only.html @@ -0,0 +1 @@ +{{ body | safe }} |
