tpl: Add `rel="noopener"` for external links
authorXhmikosR <xhmikosr@gmail.com>
Sat, 21 Sep 2019 08:08:47 +0000 (11:08 +0300)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 21 Sep 2019 08:08:47 +0000 (10:08 +0200)
This could be a security and performance issue.

See https://developers.google.com/web/tools/lighthouse/audits/noopener

tpl/tplimpl/embedded/templates.autogen.go
tpl/tplimpl/embedded/templates/shortcodes/instagram_simple.html
tpl/tplimpl/embedded/templates/shortcodes/vimeo_simple.html

index 525cff64f1c2bc9e743d480407de788cc6e506a0..0b57077bb8f6c2ec44a2a6eebe2c31ed885629a5 100644 (file)
@@ -380,7 +380,7 @@ if (!doNotTrack) {
        <div class="card-header">
     <a href="{{ $item.author_url | safeURL }}" class="card-link">{{ $item.author_name }}</a>
   </div>
-       <a href="{{ $mediaURL }}" target="_blank"><img class="card-img-top img-fluid" src="{{ $item.thumbnail_url }}" width="{{ $item.thumbnail_width }}"  height="{{ $item.thumbnail_height }}" alt="Instagram Image"></a>
+       <a href="{{ $mediaURL }}" rel="noopener" target="_blank"><img class="card-img-top img-fluid" src="{{ $item.thumbnail_url }}" width="{{ $item.thumbnail_width }}"  height="{{ $item.thumbnail_height }}" alt="Instagram Image"></a>
        <div class="card-body">
                {{ if not $hideCaption }}<p class="card-text"><a href="{{ $item.author_url | safeURL }}" class="card-link">{{ $item.author_name }}</a> {{ $item.title}}</p>{{ end }}
                <a href="{{ $item.author_url | safeURL }}" class="card-link">View More on Instagram</a>
@@ -486,7 +486,7 @@ if (!doNotTrack) {
 {{ $secondClass := "s_video_simple" }}
 <div class="{{ $secondClass }} {{ $class }}">
 {{- with $item }}
-<a href="{{ .provider_url }}{{ .video_id }}" target="_blank">
+<a href="{{ .provider_url }}{{ .video_id }}" rel="noopener" target="_blank">
 {{ $thumb := .thumbnail_url }}
 {{ $original := $thumb | replaceRE "(_.*\\.)" "." }}
 <img src="{{ $thumb }}" srcset="{{ $thumb }} 1x, {{ $original }} 2x" alt="{{ .title }}">
index 075fe980fbc1aa82ea28623179630fb9378194b4..d816093a67b4352b03c0dea9edda212c4e7bbbf8 100644 (file)
@@ -15,7 +15,7 @@
        <div class="card-header">
     <a href="{{ $item.author_url | safeURL }}" class="card-link">{{ $item.author_name }}</a>
   </div>
-       <a href="{{ $mediaURL }}" target="_blank"><img class="card-img-top img-fluid" src="{{ $item.thumbnail_url }}" width="{{ $item.thumbnail_width }}"  height="{{ $item.thumbnail_height }}" alt="Instagram Image"></a>
+       <a href="{{ $mediaURL }}" rel="noopener" target="_blank"><img class="card-img-top img-fluid" src="{{ $item.thumbnail_url }}" width="{{ $item.thumbnail_width }}"  height="{{ $item.thumbnail_height }}" alt="Instagram Image"></a>
        <div class="card-body">
                {{ if not $hideCaption }}<p class="card-text"><a href="{{ $item.author_url | safeURL }}" class="card-link">{{ $item.author_name }}</a> {{ $item.title}}</p>{{ end }}
                <a href="{{ $item.author_url | safeURL }}" class="card-link">View More on Instagram</a>
index 50699ecd4ffd93d9de8bb281173e4d43aa7cbb5c..9a4fb794d1084dce3dd83ea9adc193a801ed4364 100644 (file)
@@ -10,7 +10,7 @@
 {{ $secondClass := "s_video_simple" }}
 <div class="{{ $secondClass }} {{ $class }}">
 {{- with $item }}
-<a href="{{ .provider_url }}{{ .video_id }}" target="_blank">
+<a href="{{ .provider_url }}{{ .video_id }}" rel="noopener" target="_blank">
 {{ $thumb := .thumbnail_url }}
 {{ $original := $thumb | replaceRE "(_.*\\.)" "." }}
 <img src="{{ $thumb }}" srcset="{{ $thumb }} 1x, {{ $original }} 2x" alt="{{ .title }}">