diff --git a/assets/scss/_single.scss b/assets/scss/_single.scss
index 6360431e..16310b35 100644
--- a/assets/scss/_single.scss
+++ b/assets/scss/_single.scss
@@ -69,7 +69,7 @@
margin-left: 0.2em;
}
- p.in-reply-to, p.bookmark-of, p.next-visit {
+ p.reference-to, p.next-visit {
font-size: small;
font-style: italic;
}
@@ -553,7 +553,7 @@ details {
}
}
-.bookmark-of {
+.reference-to {
font-style: italic;
font-synthesis: none;
}
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
index 98eaa1d6..c3b1eeb8 100644
--- a/layouts/_default/_markup/render-link.html
+++ b/layouts/_default/_markup/render-link.html
@@ -1 +1 @@
-{{ partial "rich-link.html" (dict "Text" .Text "Destination" .Destination "Title" .Title "Page" .Page) }}
\ No newline at end of file
+{{ partial "rich-link.html" (dict "Text" .Text "url" .Destination "Title" .Title "references" .Page.Params.references) }}
\ No newline at end of file
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index cbefcb5a..321c3b71 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -92,9 +92,11 @@
{{ if .Params.bookmarkOf }}
-
{{ partial "bookmark-of.html" . }}
+
{{ partial "bookmark-of.html" . }}
{{ else if .Params.inReplyTo -}}
-
{{ partial "in-reply-to.html" . }}
+
{{ partial "in-reply-to.html" . }}
+ {{ else if .Params.repostOf -}}
+
{{ partial "repost-of.html" . }}
{{- end }}
{{ .Content }}
diff --git a/layouts/partials/bookmark-of.html b/layouts/partials/bookmark-of.html
index 4e6469d0..9cee4930 100644
--- a/layouts/partials/bookmark-of.html
+++ b/layouts/partials/bookmark-of.html
@@ -1,21 +1,4 @@
{{- if not .Params.bookmarkOf -}}
{{ errorf "BookmarkOf partial called when no bookmark of param set" -}}
{{- end -}}
-{{- define "partials/article-type.html" -}}
- {{- if collections.In (slice "cite" "entry") . -}}
- {{- "article" -}}
- {{- else -}}
- {{- . -}}
- {{- end -}}
-{{- end -}}
-
-{{- $page := . -}}
-{{- $url := .Params.bookmarkOf -}}
-{{- $hostname := ($url | urls.Parse).Hostname -}}
-{{- $reference := partial "reference.obj" (dict "url" $url "page" $page) -}}
-{{ partial "svg.html" (dict "name" "message") }} Thoughts on{{" "}}
-{{- with $reference.name -}}
- the {{ partial "partials/article-type.html" (default "article" $reference.type) }} {{ partial "rich-link.html" (dict "Class" "u-bookmark-of" "Destination" $url "Text" . "Page" $page) }}
-{{- else -}}
- {{ partial "rich-link.html" (dict "Class" "u-bookmark-of" "Destination" $url "Text" (printf "an article from %s" $hostname) "Page" $page) }}
-{{- end }}
+{{ partial "reference-to.html" (dict "url" .Params.bookmarkOf "references" .Params.references "svg" "message" "phrase" "Thoughts on" "mf2" "u-bookmark-of") }}
diff --git a/layouts/partials/in-reply-to.html b/layouts/partials/in-reply-to.html
index a69bd341..26bd834b 100644
--- a/layouts/partials/in-reply-to.html
+++ b/layouts/partials/in-reply-to.html
@@ -1,31 +1,4 @@
{{- if not .Params.inReplyTo -}}
{{ errorf "InReplyTo partial called when no inReplyTo param set" -}}
{{- end -}}
-{{- define "partials/article-type.html" -}}
- {{- if collections.In (slice "cite" "entry") . -}}
- {{- "article" -}}
- {{- else if eq . "calendar" -}}
- {{- "calendar event" -}}
- {{- else -}}
- {{- . | singularize -}}
- {{- end -}}
-{{- end -}}
-
-{{- $page := . -}}
-{{- $url := .Params.inReplyTo -}}
-{{- $hostname := (($url | urls.Parse).Hostname) -}}
-{{- $reference := partial "reference.obj" (dict "url" $url "page" $page) -}}
-
-{{- if and (not $reference.name) (strings.HasPrefix $url "/") -}}
- {{- $other := site.GetPage $url -}}
- {{- if and $other $other.Page -}}
- {{- $reference = dict "name" (partial "fallbacktitle.txt" $other.Page) "type" $other.Page.Type "internal" true -}}
- {{- end -}}
-{{- end -}}
-{{ partial "svg.html" (dict "name" "reply") }} As a reply to{{" "}}
-{{- with $reference.name -}}
- {{- if $reference.internal -}}my{{else}}the{{end}} {{ partial "partials/article-type.html" (default "article" $reference.type) }} {{ partial "rich-link.html" (dict "Class" "u-in-reply-to" "Destination" $url "Text" . "Page" $page) }}.
-{{- else -}}
- {{- $text := printf "an article from %s" $hostname -}}
- {{- partial "rich-link.html" (dict "Class" "u-in-reply-to" "Destination" $url "Text" $text "Page" $page) }}
-{{- end }}
+{{ partial "reference-to.html" (dict "url" .Params.inReplyTo "references" .Params.references "svg" "reply" "phrase" "As a reply to" "mf2" "u-in-reply-to") }}
diff --git a/layouts/partials/reference-to.html b/layouts/partials/reference-to.html
new file mode 100644
index 00000000..01781f96
--- /dev/null
+++ b/layouts/partials/reference-to.html
@@ -0,0 +1,30 @@
+{{- $url := .url -}}
+{{- $references := .references -}}
+{{- $mf2 := .mf2 -}}
+
+{{- define "partials/article-type.html" -}}
+ {{- if collections.In (slice "cite" "entry") . -}}
+ {{- "article" -}}
+ {{- else if eq . "calendar" -}}
+ {{- "calendar event" -}}
+ {{- else -}}
+ {{- . | singularize -}}
+ {{- end -}}
+{{- end -}}
+
+{{- $hostname := (($url | urls.Parse).Hostname) -}}
+{{- $reference := partial "reference.obj" . -}}
+
+{{- if and (not $reference.name) (strings.HasPrefix $url "/") -}}
+ {{- $other := site.GetPage $url -}}
+ {{- if and $other $other.Page -}}
+ {{- $reference = dict "name" (partial "fallbacktitle.txt" $other.Page) "type" $other.Page.Type "internal" true -}}
+ {{- end -}}
+{{- end -}}
+{{ partial "svg.html" (dict "name" .svg) }} {{ .phrase }}{{" "}}
+{{- with $reference.name -}}
+ {{- if $reference.internal -}}my{{else}}the{{end}} {{ partial "partials/article-type.html" (default "article" $reference.type) }} {{ partial "rich-link.html" (dict "Class" (printf "%s h-cite" $mf2) "url" $url "Text" . "references" $references) }}.
+{{- else -}}
+ {{- $text := printf "an article from %s" $hostname -}}
+ {{- partial "rich-link.html" (dict "Class" $mf2 "url" $url "Text" $text "references" $references) }}
+{{- end }}
diff --git a/layouts/partials/reference.obj b/layouts/partials/reference.obj
index fd7a8e51..418b3c04 100644
--- a/layouts/partials/reference.obj
+++ b/layouts/partials/reference.obj
@@ -1,7 +1,7 @@
{{- $url := .url -}}
-{{- $page := .page -}}
+{{- $references := .references -}}
{{- $reference := dict -}}
-{{- range $page.Params.references -}}
+{{- range $references -}}
{{- if eq .url $url -}}
{{- $reference = . -}}
{{- end }}
diff --git a/layouts/partials/repost-of.html b/layouts/partials/repost-of.html
new file mode 100644
index 00000000..74933443
--- /dev/null
+++ b/layouts/partials/repost-of.html
@@ -0,0 +1,6 @@
+{{- if not .Params.repostOf -}}
+ {{ errorf "RepostOf partial called when no repost param set" -}}
+{{- end -}}
+{{ partial "reference-to.html" (dict "url" .Params.repostOf "references" .Params.references "svg" "repost" "phrase" "Repost of" "mf2" "u-repost-of") }}
+
+
diff --git a/layouts/partials/rich-link.html b/layouts/partials/rich-link.html
index d3fe1d09..3d2c541e 100644
--- a/layouts/partials/rich-link.html
+++ b/layouts/partials/rich-link.html
@@ -1,6 +1,6 @@
-{{- $destination := .Destination -}}
+{{- $url := .url -}}
{{- $title := .Title -}}
-{{- $isExternal := strings.HasPrefix $destination "http" -}}
+{{- $isExternal := strings.HasPrefix $url "http" -}}
{{- $text := .Text -}}
{{/* It pains me that Hugo doesn't have a urls.IsValid method, and has no error catching to allow me to try urls.Parse and catch failures */}}
{{- if gt (len (strings.FindRE `^https?:\/\/[A-z0-9_-]*?[:]?[A-z0-9_-]*?[@]?[A-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$` .Text)) 0 -}}
@@ -17,13 +17,5 @@
{{- $text = path.Join $text "…" $last -}}
{{- end -}}
{{- end -}}
-{{- $ref := dict -}}
-{{- range $k, $refSpec := .Page.Params.references -}}
- {{- if eq $refSpec.url $destination -}}
- {{- $ref = $refSpec -}}
- {{- if and (ne $title $ref.name) (ne $text $ref.name) -}}
- {{- $title = printf "External article: %s" $ref.name -}}
- {{- end -}}
- {{- end -}}
-{{- end -}}
-