Fix fallback page titles

This commit is contained in:
JP Hastings-Spital 2024-04-07 12:33:05 +01:00
parent b405fe2994
commit 510df4bec1
8 changed files with 33 additions and 9 deletions

View file

@ -451,6 +451,10 @@ figure {
margin-right: 1rem;
vertical-align: middle;
a:before {
content: '' !important;
}
svg {
color: lch(60% 60 var(--accentHue));
margin-right: 0.3rem;

View file

@ -3,5 +3,14 @@ date: "2009-07-11T21:35:33Z"
tags:
- imported
- from-twitter
type: repost
repostOf: http://homepage.ntlworld.com/keir.clarke/nsfw.htm
references:
- url: http://homepage.ntlworld.com/keir.clarke/nsfw.htm
archiveURL: https://web.archive.org/web/20090715070455/https://homepage.ntlworld.com/keir.clarke/nsfw.htm
name: NSFW Map
date: 2009-07-15
---
Yay for being purile\! http://homepage.ntlworld.com/keir.clarke/nsfw.htm
Yay for being purile![^1]
[^1]: Here in 2024 even the archived version of that site is pretty broken; it rotates through ~100 comically "NSFW" placenames around the world, showing them on what was once a Google map.

View file

@ -3,5 +3,6 @@ date: "2009-07-11T23:36:38Z"
tags:
- imported
- from-twitter
- maps
---
Anyone know where I can find a monochrome land/sea mercator projection map of the world in SVG, pref lat ±85º?

View file

@ -25,7 +25,7 @@
<li class="post-item">
<a href="{{.RelPermalink}}">
{{ if .Params.emoji }}<span class="post-emoji">{{ .Params.emoji }}</span>{{ end }}
<span class="post-title">{{ partial "fallbacktitle.txt" . }}</span>
<span class="post-title">{{ partial "page-title.txt" . }}</span>
<span class="post-day">
{{ if .Site.Params.dateformShort }}
{{ .Date.Format .Site.Params.dateformShort }}

View file

@ -1,5 +0,0 @@
{{ if .Title -}}
{{- .Title -}}
{{- else -}}
{{- .Type | singularize | title }} from {{ partial "year-relative-date.txt" .Date -}}
{{- end -}}

View file

@ -26,7 +26,7 @@
{{- if .IsHome -}}
{{- $.Site.Title -}}
{{- else -}}
{{- if .Title -}}{{- .Title -}}{{- else -}}Untitled {{ $.Type | singularize -}}{{- end -}}, {{ $.Site.Title -}}
{{ partial "page-title.txt" . }}, {{ $.Site.Title -}}
{{- end -}}
</title>
{{- end }}

View file

@ -0,0 +1,15 @@
{{- define "partials/fallback-title.txt" -}}
{{- .Type | singularize | title }} from {{ partial "year-relative-date.txt" .Date -}}
{{- end -}}
{{- if .Title -}}
{{- .Title -}}
{{- else if or .Params.bookmarkOf .Params.repostOf -}}
{{- $ref := partial "reference.obj" (dict "url" (.Params.bookmarkOf | default .Params.repostOf) "references" .Params.references) -}}
{{- if $ref -}}
Comments on '{{ $ref.name }}'
{{- else -}}
{{- partial "partials/fallback-title.txt" . -}}
{{- end -}}
{{- else -}}
{{- partial "partials/fallback-title.txt" . -}}
{{- end -}}

View file

@ -18,7 +18,7 @@
{{- 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 -}}
{{- $reference = dict "name" (partial "page-title.txt" $other.Page) "type" $other.Page.Type "internal" true -}}
{{- end -}}
{{- end -}}
{{ partial "svg.html" (dict "name" .svg) }} {{ .phrase }}{{" "}}