External links open in a new tab

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YDRjtmAiNpo5mK5N3d7QwZ
This commit is contained in:
2026-10-11 21:05:40 +02:00
co-authored by Claude Opus 5.5
parent 9acee407d4
commit 2b5c9df929
9 changed files with 16 additions and 7 deletions
+4
View File
@@ -0,0 +1,4 @@
{{- /* Markdown links: external ones open in a new tab */ -}}
{{- $external := findRE `(?i)^(https?:)?//` .Destination -}}
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if $external }} target="_blank" rel="noopener"{{ end }}>{{ .Text }}</a>
{{- /* no trailing newline */ -}}
+1 -1
View File
@@ -1,7 +1,7 @@
{{/* list of {title, url, text, platform} */}}
<dl class="entries">
{{ range . }}
<dt>{{ if .url }}<a href="{{ .url }}" rel="nofollow noopener">{{ .title | default .url }}</a>{{ else }}{{ .title }}{{ end }}{{ with .platform }} <small>{{ . }}</small>{{ end }}</dt>
<dt>{{ if .url }}<a href="{{ .url }}"{{ partial "ext.html" .url }}>{{ .title | default .url }}</a>{{ else }}{{ .title }}{{ end }}{{ with .platform }} <small>{{ . }}</small>{{ end }}</dt>
{{ with .text }}<dd>{{ . | markdownify }}</dd>{{ end }}
{{ end }}
</dl>
+5
View File
@@ -0,0 +1,5 @@
{{- /* attributes for a link to this address: external ones open in a new tab */ -}}
{{- if findRE `(?i)^(https?:)?//` (string .) -}}
{{- return (` target="_blank" rel="noopener"` | safeHTMLAttr) -}}
{{- end -}}
{{- return ("" | safeHTMLAttr) -}}
+1 -1
View File
@@ -31,7 +31,7 @@
</main>
<footer class="site-footer">
{{ with .Params.source }}
<p>Recovered from the <a href="{{ .url }}">Wayback Machine capture of {{ .date }}</a>.</p>
<p>Recovered from the <a href="{{ .url }}"{{ partial "ext.html" .url }}>Wayback Machine capture of {{ .date }}</a>.</p>
{{ end }}
<p>Content © its original authors at Old-Computers.com. Rebuilt from the Internet Archive</p>
<p><a href="{{ site.Home.RelPermalink }}members/">Members</a> -
+1 -1
View File
@@ -27,7 +27,7 @@
{{ with .cover }}<img src="{{ . }}" alt="" loading="lazy">{{ end }}
<figcaption>
{{ if .text }}<div>{{ .text | markdownify }}</div>
{{ else }}<a href="{{ .url }}"><strong>{{ .title }}</strong></a>{{ end }}
{{ else }}<a href="{{ .url }}"{{ partial "ext.html" .url }}><strong>{{ .title }}</strong></a>{{ end }}
</figcaption>
</figure>
{{ end }}