remove target='_blank' from external links for better security and accessibility

This commit is contained in:
John Bowdre 2024-07-03 21:33:59 -05:00
parent a419ec04d2
commit 57d73646b8
7 changed files with 15 additions and 24 deletions

View file

@ -9,45 +9,33 @@
name = "self-hosting" name = "self-hosting"
url = "/categories/self-hosting/" url = "/categories/self-hosting/"
weight = 1 weight = 1
[[main.params]]
target = "_self"
[[main]] [[main]]
identifier = "tips" identifier = "tips"
name = "tips" name = "tips"
url = "/categories/tips/" url = "/categories/tips/"
weight = 1 weight = 1
[[main.params]]
target = "_self"
[[main]] [[main]]
identifier = "code" identifier = "code"
name = "code" name = "code"
url = "/categories/code/" url = "/categories/code/"
weight = 1 weight = 1
[[main.params]]
target = "_self"
[[main]] [[main]]
identifier = "backstage" identifier = "backstage"
name = "backstage" name = "backstage"
url = "/categories/backstage/" url = "/categories/backstage/"
weight = 1 weight = 1
[[main.params]]
target = "_self"
[[main]] [[main]]
identifier = "slashes" identifier = "slashes"
name = "slashes" name = "slashes"
url = "/slashes/" url = "/slashes/"
weight = 10 weight = 10
[[main.params]]
target = "_self"
[[main]] [[main]]
identifier = "notes" identifier = "notes"
name = "notes↗" name = "notes↗"
url = "https://notes.runtimeterror.dev" url = "https://notes.runtimeterror.dev"
weight = 100 weight = 100
[[main.params]]
target = "_blank"

View file

@ -1,7 +1,7 @@
--- ---
title: "/changelog" title: "/changelog"
date: "2024-05-26T21:19:08Z" date: "2024-05-26T21:19:08Z"
lastmod: "2024-06-29T03:55:04Z" lastmod: "2024-07-04T02:32:27Z"
description: "Maybe I should keep a log of all my site-related tinkering?" description: "Maybe I should keep a log of all my site-related tinkering?"
featured: false featured: false
toc: false toc: false
@ -10,6 +10,9 @@ categories: slashes
--- ---
*High-level list of config/layout changes to the site. The full changelog is of course [on GitHub](https://github.com/jbowdre/runtimeterror/commits/main/).* *High-level list of config/layout changes to the site. The full changelog is of course [on GitHub](https://github.com/jbowdre/runtimeterror/commits/main/).*
**2024-07-03:**
- Remove `target="_blank"` from external links for improved security and accessibility
**2024-06-28:** **2024-06-28:**
- Add [recentfm.js](https://recentfm.rknight.me/) recently-played widget to sidebar - Add [recentfm.js](https://recentfm.rknight.me/) recently-played widget to sidebar
- Use [Hugo render-hook](https://gohugo.io/render-hooks/links/#examples) to add ↗ marker to external links - Use [Hugo render-hook](https://gohugo.io/render-hooks/links/#examples) to add ↗ marker to external links

View file

@ -1,7 +1,7 @@
--- ---
title: "The Slash Page Scoop" title: "The Slash Page Scoop"
date: 2024-06-02 date: 2024-06-02
# lastmod: 2024-05-30 lastmod: "2024-07-04T02:23:41Z"
description: "I've added new slash pages to the site to share some background info on who I am, what I use, and how this site works." description: "I've added new slash pages to the site to share some background info on who I am, what I use, and how this site works."
featured: false featured: false
toc: true toc: true
@ -101,7 +101,7 @@ Of course, I'd like to include a link to [slashpages.net](https://slashpages.net
{{ if .IsHome }} {{ if .IsHome }}
<h1>{{ site.Params.indexTitle | markdownify }}</h1> <h1>{{ site.Params.indexTitle | markdownify }}</h1>
{{ else }} {{ else }}
<h1>{{ .Title | markdownify }}{{ if eq .Kind "term" }}&nbsp;<a target="_blank" href="{{ .Permalink }}feed.xml" aria-label="Category RSS"><i class="fa-solid fa-square-rss"></i></a>&nbsp;</h1> <!-- [tl! ~~] --> <h1>{{ .Title | markdownify }}{{ if eq .Kind "term" }}&nbsp;<a href="{{ .Permalink }}feed.xml" aria-label="Category RSS"><i class="fa-solid fa-square-rss"></i></a>&nbsp;</h1> <!-- [tl! ~~] -->
{{ with .Description }}<i>{{ . }}</i><hr>{{ else }}<br>{{ end }} {{ with .Description }}<i>{{ . }}</i><hr>{{ else }}<br>{{ end }}
{{ end }}{{ end }} {{ end }}{{ end }}
{{ .Content }} {{ .Content }}
@ -122,9 +122,9 @@ Line 9 is where I had already modified the template to conditionally add an RSS
{{ else }} {{ else }}
{{ if eq .Title "/slashes" }} <!-- [tl! **:3 ++:3 ] --> {{ if eq .Title "/slashes" }} <!-- [tl! **:3 ++:3 ] -->
<h1>{{ .Title | markdownify }}</h1> <h1>{{ .Title | markdownify }}</h1>
<i>My collection of <a target="_blank" title="what's a slashpage?" href="https://slashpages.net">slash pages</a>.</i><hr> <i>My collection of <a title="what's a slashpage?" href="https://slashpages.net">slash pages</a>.</i><hr>
{{ else }} {{ else }}
<h1>{{ .Title | markdownify }}{{ if eq .Kind "term" }}&nbsp;<a target="_blank" href="{{ .Permalink }}feed.xml" aria-label="Category RSS"><i class="fa-solid fa-square-rss"></i></a>&nbsp;</h1> <h1>{{ .Title | markdownify }}{{ if eq .Kind "term" }}&nbsp;<a href="{{ .Permalink }}feed.xml" aria-label="Category RSS"><i class="fa-solid fa-square-rss"></i></a>&nbsp;</h1>
{{ with .Description }}<i>{{ . }}</i><hr>{{ else }}<br>{{ end }} {{ with .Description }}<i>{{ . }}</i><hr>{{ else }}<br>{{ end }}
{{ end }} <!-- [tl! ** ++ ] --> {{ end }} <!-- [tl! ** ++ ] -->
{{ end }}{{ end }} {{ end }}{{ end }}

View file

@ -1,7 +1,7 @@
{{ with .Site.Params.about }} {{ with .Site.Params.about }}
<div class="aside__about"> <div class="aside__about">
{{ with .logo }}<img class="about__logo" src="{{ . | absURL }}" alt="Logo">{{ end }} {{ with .logo }}<img class="about__logo" src="{{ . | absURL }}" alt="Logo">{{ end }}
<h1 class="about__title">{{ .title }}&nbsp;<a target="_blank" href="/feed.xml" aria-label="RSS"><i class="fa-solid fa-square-rss"></i></a>&nbsp;</h1> <h1 class="about__title">{{ .title }}&nbsp;<a href="/feed.xml" aria-label="RSS"><i class="fa-solid fa-square-rss"></i></a>&nbsp;</h1>
{{ partial "tagline.html" . }} {{ partial "tagline.html" . }}
<br> <br>
<a href="/about/"><i class="fa-regular fa-user"></i></a>&nbsp;<a href="/about/">{{ site.Params.Author.name }}</a> <a href="/about/"><i class="fa-regular fa-user"></i></a>&nbsp;<a href="/about/">{{ site.Params.Author.name }}</a>
@ -10,7 +10,7 @@
<ul class="aside__social-links"> <ul class="aside__social-links">
{{ range $item := .Site.Params.socialLinks }} {{ range $item := .Site.Params.socialLinks }}
<li> <li>
<a target="_blank" href="{{ $item.url | safeURL }}" rel="me" aria-label="{{ $item.title }}" title="{{ $item.title }}"><i class="{{ $item.icon }}" aria-hidden="true"></i></a>&nbsp; <a href="{{ $item.url | safeURL }}" rel="me" aria-label="{{ $item.title }}" title="{{ $item.title }}"><i class="{{ $item.icon }}" aria-hidden="true"></i></a>&nbsp;
</li> </li>
{{ end }} {{ end }}
</ul> </ul>

View file

@ -8,9 +8,9 @@
{{ else }} {{ else }}
{{ if eq .Title "/slashes" }} {{ if eq .Title "/slashes" }}
<h1>{{ .Title | markdownify }}</h1> <h1>{{ .Title | markdownify }}</h1>
<i>My collection of <a target="_blank" title="what's a slashpage?" href="https://slashpages.net">slash pages</a>.</i><hr> <i>My collection of <a title="what's a slashpage?" href="https://slashpages.net">slash pages</a>.</i><hr>
{{ else }} {{ else }}
<h1>{{ .Title | markdownify | lower }}{{ if eq .Kind "term" }}&nbsp;<a target="_blank" href="{{ .Permalink }}feed.xml" aria-label="{{ .Title }} RSS" title="{{ .Title }} RSS"><i class="fa-solid fa-square-rss"></i></a>&nbsp;</h1> <h1>{{ .Title | markdownify | lower }}{{ if eq .Kind "term" }}&nbsp;<a href="{{ .Permalink }}feed.xml" aria-label="{{ .Title }} RSS" title="{{ .Title }} RSS"><i class="fa-solid fa-square-rss"></i></a>&nbsp;</h1>
{{ with .Description }}<i>{{ . }}</i>{{ end }} {{ with .Description }}<i>{{ . }}</i>{{ end }}
{{ end }} {{ end }}
<hr> <hr>

View file

@ -1,6 +1,6 @@
<span class="footer_slashes">{"<a href="/slashes/" title="slashpages">/slashes</a>": [{{- range $i, $link := .Site.Params.slashPages }}{{ if $i }}, {{ end }}&quot;<a href="{{ $link.url }}" title="{{ $link.label }}">{{ $link.title }}</a>&quot;{{ end }}]}</span> <span class="footer_slashes">{"<a href="/slashes/" title="slashpages">/slashes</a>": [{{- range $i, $link := .Site.Params.slashPages }}{{ if $i }}, {{ end }}&quot;<a href="{{ $link.url }}" title="{{ $link.label }}">{{ $link.title }}</a>&quot;{{ end }}]}</span>
<br><span class="copyright" xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/">{"copyright": ["content": "<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" rel="license noopener noreferrer" title="Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International">CC BY-NC-SA 4.0</a>", "code": "<a href="https://github.com/jbowdre/runtimeterror/blob/main/LICENSE" target="_blank" rel="license noopener noreferrer" title="MIT License">MIT</a>"]}</span> <br><span class="copyright" xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/">{"copyright": ["content": "<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="license noopener noreferrer" title="Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International">CC BY-NC-SA 4.0</a>", "code": "<a href="https://github.com/jbowdre/runtimeterror/blob/main/LICENSE" rel="license noopener noreferrer" title="MIT License">MIT</a>"]}</span>
<br><span class="footer_links">&lt;<a target="_blank" href="https://github.com/jbowdre/runtimeterror">view source</a>&gt;</span> <br><span class="footer_links">&lt;<a href="https://github.com/jbowdre/runtimeterror">view source</a>&gt;</span>
<!-- Back to Top button via https://github.com/vfeskov/vanilla-back-to-top --> <!-- Back to Top button via https://github.com/vfeskov/vanilla-back-to-top -->
{{ $jsToTop := resources.Get "js/back-to-top.js" | minify }} {{ $jsToTop := resources.Get "js/back-to-top.js" | minify }}

View file

@ -3,7 +3,7 @@
<h1 class="page__logo"><a href="{{ .Site.BaseURL }}" class="page__logo-inner">{{ .Site.Title }}</a></h1> <h1 class="page__logo"><a href="{{ .Site.BaseURL }}" class="page__logo-inner">{{ .Site.Title }}</a></h1>
{{ $currentPage := . }} {{ $currentPage := . }}
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
<li class="main-nav__item"><a class="nav-main-item{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) (eq ($currentPage.Permalink) (.URL | absLangURL)) }} active{{end}}" href="{{ .URL | absLangURL }}" title="{{ .Title }}" target="{{ .Params.target }}">{{ .Name }}</a></li> <li class="main-nav__item"><a class="nav-main-item{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) (eq ($currentPage.Permalink) (.URL | absLangURL)) }} active{{end}}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a></li>
{{ end }} {{ end }}
</ul> </ul>
</nav> </nav>