Experimental support for webmentions
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
8640d5764c
commit
dcdaa3fc25
@ -58,6 +58,11 @@ function getBlogPosts($params) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($params['slug'])) {
|
||||||
|
$post["webmentions"] = getWebmentions($post["url"]);
|
||||||
|
$post["hasWebmentions"] = count($post["webmentions"]) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
$posts[] = $post;
|
$posts[] = $post;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,6 +109,11 @@ function getNotes($params) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($params['slug'])) {
|
||||||
|
$post["webmentions"] = getWebmentions($post["url"]);
|
||||||
|
$post["hasWebmentions"] = count($post["webmentions"]) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
$posts[] = $post;
|
$posts[] = $post;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,12 +160,29 @@ function getProjects($params) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($params['slug'])) {
|
||||||
|
$project["webmentions"] = getWebmentions($post["url"]);
|
||||||
|
$project["hasWebmentions"] = count($project["webmentions"]) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
$projects[] = $project;
|
$projects[] = $project;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $projects;
|
return $projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getWebmentions($target) {
|
||||||
|
$data json_decode(file_get_contents("https://webm.yarmo.eu/get?target=$target"), true);
|
||||||
|
|
||||||
|
foreach ($data as $id => $entry) {
|
||||||
|
$time = strtotime($entry["created_at"]);
|
||||||
|
$data[$id]["date"] = date("Y-m-d",$time);
|
||||||
|
$data[$id]["time"] = date("H:i:s",$time);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
function getFOSS() {
|
function getFOSS() {
|
||||||
return Yaml::parseFile('content/foss/foss.yaml');
|
return Yaml::parseFile('content/foss/foss.yaml');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -307,6 +307,10 @@ table.music th:nth-child(3) {
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-size: 90%;
|
font-size: 90%;
|
||||||
}
|
}
|
||||||
|
.webmentions {
|
||||||
|
margin: 64px 0 0;
|
||||||
|
border-top: 3px dashed rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
/* Lists */
|
/* Lists */
|
||||||
.list {
|
.list {
|
||||||
|
|||||||
@ -1,5 +1,10 @@
|
|||||||
extends layout
|
extends layout
|
||||||
|
|
||||||
|
mixin webmention($item)
|
||||||
|
p
|
||||||
|
a(href="{$item['source']}") !{$item['title']}
|
||||||
|
| by !{$item['author_name']} on !{$item['date']} at !{$item['time']}
|
||||||
|
|
||||||
block content
|
block content
|
||||||
header
|
header
|
||||||
nav
|
nav
|
||||||
@ -19,3 +24,11 @@ block content
|
|||||||
|
|
||||||
.longform__content.e-content
|
.longform__content.e-content
|
||||||
| !{$post['content']}
|
| !{$post['content']}
|
||||||
|
|
||||||
|
.webmentions
|
||||||
|
h2 Webmentions
|
||||||
|
if ($post['hasWebmentions'])
|
||||||
|
each $item in $post["webmentions"]
|
||||||
|
+webmention($item)
|
||||||
|
else
|
||||||
|
p This post has not been mentioned yet.
|
||||||
|
|||||||
@ -1,5 +1,10 @@
|
|||||||
extends layout
|
extends layout
|
||||||
|
|
||||||
|
mixin webmention($item)
|
||||||
|
p
|
||||||
|
a(href="{$item['source']}") !{$item['title']}
|
||||||
|
| by !{$item['author_name']} on !{$item['date']} at !{$item['time']}
|
||||||
|
|
||||||
block content
|
block content
|
||||||
header
|
header
|
||||||
nav
|
nav
|
||||||
@ -19,3 +24,11 @@ block content
|
|||||||
|
|
||||||
.longform__content.e-content
|
.longform__content.e-content
|
||||||
| !{$post['content']}
|
| !{$post['content']}
|
||||||
|
|
||||||
|
.webmentions
|
||||||
|
h2 Webmentions
|
||||||
|
if ($post['hasWebmentions'])
|
||||||
|
each $item in $post["webmentions"]
|
||||||
|
+webmention($item)
|
||||||
|
else
|
||||||
|
p This post has not been mentioned yet.
|
||||||
|
|||||||
@ -1,5 +1,10 @@
|
|||||||
extends layout
|
extends layout
|
||||||
|
|
||||||
|
mixin webmention($item)
|
||||||
|
p
|
||||||
|
a(href="{$item['source']}") !{$item['title']}
|
||||||
|
| by !{$item['author_name']} on !{$item['date']} at !{$item['time']}
|
||||||
|
|
||||||
block content
|
block content
|
||||||
header
|
header
|
||||||
nav
|
nav
|
||||||
@ -17,3 +22,11 @@ block content
|
|||||||
p.longform__header
|
p.longform__header
|
||||||
.longform__content
|
.longform__content
|
||||||
| !{$project['content']}
|
| !{$project['content']}
|
||||||
|
|
||||||
|
.webmentions
|
||||||
|
h2 Webmentions
|
||||||
|
if ($project['hasWebmentions'])
|
||||||
|
each $item in $project["webmentions"]
|
||||||
|
+webmention($item)
|
||||||
|
else
|
||||||
|
p This project has not been mentioned yet.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user