diff options
author | cntrump <cntrump@gmail.com> | 2021-01-26 15:17:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-26 15:17:10 +0300 |
commit | 18959a6ae3994790087ef89be43f1b6288ef7e92 (patch) | |
tree | dfe5548e1578b119b53f14756b396e8244f93de0 | |
parent | 757ef2d37ac980f8fd1f2945f49095d33c7c27dd (diff) | |
parent | 7d0f8e7e987bdba3c2ad5b49caa28e45d7ef2b91 (diff) |
Merge pull request #108 from kofuk/link-noopener
Add noopener attribute to external links
-rw-r--r-- | layouts/_default/_markup/render-link.html | 2 | ||||
-rw-r--r-- | layouts/partials/article-author.html | 10 | ||||
-rw-r--r-- | layouts/partials/copyright.html | 6 | ||||
-rw-r--r-- | layouts/partials/navigation-items.html | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index 312379b..4b2feef 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -2,4 +2,4 @@ {{- $text := .Text | safeHTML -}} <a href="{{- $url -}}" {{- with .Title -}}title="{{- . -}}"{{- end -}} -{{- if strings.HasPrefix $url "http" -}}target="_blank"{{- end -}}>{{- $text -}}</a>
\ No newline at end of file +{{- if strings.HasPrefix $url "http" -}}target="_blank" rel="noopener noreferrer"{{- end -}}>{{- $text -}}</a> diff --git a/layouts/partials/article-author.html b/layouts/partials/article-author.html index a3e12e3..4ea8c6a 100644 --- a/layouts/partials/article-author.html +++ b/layouts/partials/article-author.html @@ -14,21 +14,21 @@ <div class="details"> {{- with .github -}} - <a class="item" href="https://github.com/{{- . | safeHTML -}}" target="_blank"><span class="iconfont icon-github"></span> {{- . -}}</a> + <a class="item" href="https://github.com/{{- . | safeHTML -}}" target="_blank" rel="noopener noreferrer"><span class="iconfont icon-github"></span> {{- . -}}</a> {{- end -}} {{- with .docker -}} - <a class="item" href="https://hub.docker.com/u/{{- . | safeHTML -}}" target="_blank"><span class="iconfont icon-docker"></span> {{- . -}}</a> + <a class="item" href="https://hub.docker.com/u/{{- . | safeHTML -}}" target="_blank" rel="noopener noreferrer"><span class="iconfont icon-docker"></span> {{- . -}}</a> {{- end -}} {{- with .twitter -}} - <a class="item" href="https://twitter.com/{{- . | safeHTML -}}" target="_blank"><span class="iconfont icon-twitter"></span> @{{- . -}}</a> + <a class="item" href="https://twitter.com/{{- . | safeHTML -}}" target="_blank" rel="noopener noreferrer"><span class="iconfont icon-twitter"></span> @{{- . -}}</a> {{- end -}} {{- with .email -}} - <a class="item" href="mailto:{{- . | safeHTML -}}" target="_blank"><span class="iconfont icon-email"></span> {{- . -}}</a> + <a class="item" href="mailto:{{- . | safeHTML -}}" target="_blank" rel="noopener noreferrer"><span class="iconfont icon-email"></span> {{- . -}}</a> {{- end -}} </div> </section> {{- end -}} -{{- end -}}
\ No newline at end of file +{{- end -}} diff --git a/layouts/partials/copyright.html b/layouts/partials/copyright.html index 6ee749c..215f256 100644 --- a/layouts/partials/copyright.html +++ b/layouts/partials/copyright.html @@ -2,7 +2,7 @@ <div class="footer-wrap"> <p class="copyright">{{- $copyright -}}</p> <p class="powerby"><span>Powered by </span><a href="https://gohugo.io" - target="_blank">Hugo</a><span> & </span><a href="https://themes.gohugo.io/hugo-notepadium/" - target="_blank">Notepadium</a></p> + target="_blank" rel="noopener noreferrer">Hugo</a><span> & </span><a href="https://themes.gohugo.io/hugo-notepadium/" + target="_blank" rel="noopener noreferrer">Notepadium</a></p> {{- partial "beian.html" . -}} -</div>
\ No newline at end of file +</div> diff --git a/layouts/partials/navigation-items.html b/layouts/partials/navigation-items.html index 882279c..60fbf4a 100644 --- a/layouts/partials/navigation-items.html +++ b/layouts/partials/navigation-items.html @@ -13,8 +13,8 @@ {{- $url = $url | safeURL -}} {{- if strings.HasPrefix $url "/" -}}{{- $url = $url | relLangURL -}}{{- end -}} <a class="nav item" href="{{- $url -}}" - {{- if strings.HasPrefix $url "http" -}}target="_blank" + {{- if strings.HasPrefix $url "http" -}}target="_blank" rel="noopener noreferrer" {{- end -}}>{{- .title -}}</a> {{- end -}} </nav></div> -{{- end -}}
\ No newline at end of file +{{- end -}} |