Browse Source

Support comment webmentions

master
Yarmo Mackenbach 1 week ago
parent
commit
c6616ae9df
3 changed files with 70 additions and 11 deletions
  1. +12
    -0
      static/style.css
  2. +24
    -11
      views/post.pug
  3. +34
    -0
      views/reply.pug

+ 12
- 0
static/style.css View File

@ -282,6 +282,18 @@ table.music th:nth-child(3) {
font-style: normal;
font-size: 90%;
}
.comment {
padding: 12px;
margin: 32px 0 0;
background-color: var(--clr-bg-alt);
}
.comment .quote {
margin: 0 0 12px;
font-family: 'Lora', Georgia, Times, serif;
}
.comment .sub {
margin: 0;
}
.subsection {
margin: 64px 0 0;
border-top: 3px dashed rgba(0,0,0,0.5);

+ 24
- 11
views/post.pug View File

@ -1,17 +1,30 @@
extends layout
mixin webmention($item)
p
if (array_key_exists('title', $item))
a(href="{$item['source']}") !{$item['title']}
else
a(href="{$item['source']}") !{$item['source']}
if (array_key_exists('author_name', $item))
| by !{$item['author_name']}
if (array_key_exists('date', $item))
| on !{$item['date']}
if (array_key_exists('time', $item))
| at !{$item['time']} UTC
if (!array_key_exists('type', $item))
p
if (array_key_exists('title', $item))
a(href="{$item['source']}") !{$item['title']}
else
a(href="{$item['source']}") !{$item['source']}
if (array_key_exists('author_name', $item))
| by !{$item['author_name']}
if (array_key_exists('date', $item))
| on !{$item['date']}
if (array_key_exists('time', $item))
| at !{$item['time']} UTC
else if ($item['type'] == "comment")
.comment
p.quote
| !{$item['title']}
p.sub
a(href="{$item['source']}") Commented
if (array_key_exists('author_name', $item))
| by !{$item['author_name']}
if (array_key_exists('date', $item))
| on !{$item['date']}
if (array_key_exists('time', $item))
| at !{$item['time']} UTC
mixin discussionLink($item)
p

+ 34
- 0
views/reply.pug View File

@ -1,5 +1,31 @@
extends layout
mixin webmention($item)
if (!array_key_exists('type', $item))
p
if (array_key_exists('title', $item))
a(href="{$item['source']}") !{$item['title']}
else
a(href="{$item['source']}") !{$item['source']}
if (array_key_exists('author_name', $item))
| by !{$item['author_name']}
if (array_key_exists('date', $item))
| on !{$item['date']}
if (array_key_exists('time', $item))
| at !{$item['time']} UTC
else if ($item['type'] == "comment")
.comment
p.quote
| !{$item['title']}
p.sub
a(href="{$item['source']}") Commented
if (array_key_exists('author_name', $item))
| by !{$item['author_name']}
if (array_key_exists('date', $item))
| on !{$item['date']}
if (array_key_exists('time', $item))
| at !{$item['time']} UTC
block content
header
nav
@ -21,3 +47,11 @@ block content
| :
br
| !{$reply['content']}
.webmentions.subsection
h2 Webmentions
if ($reply['hasWebmentions'])
each $item in $reply["webmentions"]
+webmention($item)
else
p This post has not been mentioned yet.

Loading…
Cancel
Save