jlelse
/
Indieroad
Archived
1
Fork 0

Support for displaying webmentions

This commit is contained in:
Jan-Lukas Else 2019-12-12 09:09:31 +01:00
parent f1b903fb49
commit b66a0fd89a
7 changed files with 87 additions and 9 deletions

View File

@ -633,6 +633,33 @@ select {
}
}
.mentions {
@include subarticle-element;
line-height: 1.5;
display: block;
@media screen and (max-width: $break1) {
text-align: center;
}
.caption {
font-weight: 700;
line-height: 1;
text-transform: uppercase;
}
.mentions-list {
margin-top: 5px;
list-style: none;
.item {
.link {
.post-title {
margin-bottom: 0;
overflow: hidden;
font-size: .8125rem;
}
}
}
}
}
/* List content */
.list {
.list-item {

View File

@ -51,4 +51,7 @@
translation: "Related"
- id: share
translation: "Share"
translation: "Share"
- id: interactions
translation: "Interactions"

View File

@ -23,14 +23,7 @@
{{ else }}
<link rel="canonical" href="{{ .Permalink }}">
{{ end }}
{{- if .Param "indieweb.enabled" }}
{{- with .Param "indieweb.endpoints.webmention" }}
<link rel="webmention" href="{{ . }}" />
{{- end }}
{{- with .Param "indieweb.endpoints.pingback" }}
<link rel="pingback" href="{{ . }}" />
{{- end }}
{{- end }}
{{ partial "indiewebhead" . }}
{{ partial "customhead" . }}
</head>
<body class="body">

View File

@ -0,0 +1,19 @@
{{- $mentions := .Site.Data.mentions -}}
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ T "interactions" }} {{ .Site.Title }}",
"feed_url": "{{ .Permalink }}",
"items": [
{{ $delimiter := "" -}}
{{- range $key, $pagementions := $mentions -}}
{{- range $pagekey, $mention := $pagementions -}}
{{- $delimiter -}}{
"id": "{{ $key }}{{ $pagekey }}",
"url": "{{ $mention.source }}",
"date_published": "{{ dateFormat "2006-01-02T15:04:05-07:00" $mention.date }}"
}
{{- $delimiter = "," -}}
{{- end -}}
{{- end }}
]
}

View File

@ -23,5 +23,6 @@
{{ partial "authorbox.html" . }}
</main>
{{ partial "webmentionform" . }}
{{ partial "mentions.html" . }}
{{ partial "post_nav.html" . }}
{{ end }}

View File

@ -0,0 +1,17 @@
{{- if .Param "indieweb.enabled" }}
{{- with .Param "indieweb.endpoints.webmention" }}
<link rel="webmention" href="{{ . }}" />
{{- end }}
{{- with .Param "indieweb.endpoints.pingback" }}
<link rel="pingback" href="{{ . }}" />
{{- end }}
{{- with .Param "indieweb.endpoints.auth_endpoint" }}
<link rel="authorization_endpoint" href="{{ . }}" />
{{- end }}
{{- with .Param "indieweb.endpoints.token_endpoint" }}
<link rel="token_endpoint" href="{{ . }}" />
{{- end }}
{{- with .Param "indieweb.endpoints.micropub" }}
<link rel="micropub" href="{{ . }}" />
{{- end }}
{{- end }}

View File

@ -0,0 +1,18 @@
{{ if .Param "indieweb.enabled" }}
{{ $md5pl := md5 .Permalink }}
{{ $mentions := index .Site.Data.mentions $md5pl }}
{{ $dateFormat := ( .Site.Params.dateformat | default "January 02, 2006") }}
{{ with $mentions }}
<div class="mentions">
<details>
<summary class="caption">{{ T "interactions" }}</summary>
<ul class="mentions-list">
{{ range . }}
{{ $sourceUrl := urls.Parse .source }}
<li class="item"><a href="{{ .source }}" target="_blank" rel="nofollow noopener">{{ $sourceUrl.Host }}</a> <i>{{ dateFormat $dateFormat .date }}</i></li>
{{ end }}
</ul>
</details>
</div>
{{ end }}
{{ end }}