Skip to content

Commit

Permalink
when setting target="_blank" no needed rel="noopener"
Browse files Browse the repository at this point in the history
  • Loading branch information
tianheg committed May 6, 2022
1 parent 6e8dfb4 commit e5d552c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{- $linkType := (string .Pre) -}}
{{- $iconName := (string .Post) -}}
{{- $icon := (index $.Site.Data.SVG $iconName) -}}
<a href="{{ .URL }}"{{ if eq $linkType "external" }} target="_blank" rel="external noopener"{{ end }}>{{ partial "utils/icon.html" (dict "$" $ "name" $iconName "class" .Identifier) }}{{ .Name }}</a>
<a href="{{ .URL }}"{{ if eq $linkType "external" }} target="_blank" rel="external"{{ end }}>{{ partial "utils/icon.html" (dict "$" $ "name" $iconName "class" .Identifier) }}{{ .Name }}</a>
{{ end }}
</div>
{{ end }}
Expand All @@ -17,7 +17,7 @@
{{- $linkType := (string .Pre) -}}
{{- $iconName := (string .Post) -}}
{{- $icon := (index $.Site.Data.SVG $iconName) -}}
<a href="{{ .URL }}"{{ if eq $linkType "external" }} target="_blank" rel="external noopener"{{ end }}>{{ partial "utils/icon.html" (dict "$" $ "name" $iconName "class" .Identifier) }}{{ .Name }}</a>
<a href="{{ .URL }}"{{ if eq $linkType "external" }} target="_blank" rel="external"{{ end }}>{{ partial "utils/icon.html" (dict "$" $ "name" $iconName "class" .Identifier) }}{{ .Name }}</a>
{{ end }}
</div>
{{ end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ul class="post-copyright">
<li class="copyright-item author">
{{- with $author.website -}}
<span class="copyright-item-text">{{ i18n "copyrightAuthor" }}</span>{{ i18n "colon" }}<a href="{{ . }}" class="p-author h-card" target="_blank" rel="noopener">{{ $author.name }}</a>
<span class="copyright-item-text">{{ i18n "copyrightAuthor" }}</span>{{ i18n "colon" }}<a href="{{ . }}" class="p-author h-card" target="_blank">{{ $author.name }}</a>
{{- else -}}
<span class="copyright-item-text">{{ i18n "copyrightAuthor" }}</span>{{ i18n "colon" }}<span class="p-author h-card">{{ $author.name }}</span>
{{- end -}}
Expand All @@ -14,10 +14,10 @@
{{ $decodedPath := $url.Path }}
{{ $baseURLWithLangFix := (strings.TrimSuffix "/" (print `/` | absLangURL)) }}
{{ $decodedPermalink := (printf `%s%s` $baseURLWithLangFix $decodedPath) }}
<li class="copyright-item link"><span class="copyright-item-text">{{ i18n "copyrightLink" }}</span>{{ i18n "colon" }}<a href="{{ $.RelPermalink }}" target="_blank" rel="noopener">{{ $decodedPermalink }}</a></li>
<li class="copyright-item link"><span class="copyright-item-text">{{ i18n "copyrightLink" }}</span>{{ i18n "colon" }}<a href="{{ $.RelPermalink }}" target="_blank">{{ $decodedPermalink }}</a></li>
{{ else }}
{{ with $.Params.link }}
<li class="copyright-item link"><span class="copyright-item-text">{{ i18n "copyrightLink" }}</span>{{ i18n "colon" }}<a href="{{ . }}" target="_blank" rel="noopener">{{ . }}</a></li>
<li class="copyright-item link"><span class="copyright-item-text">{{ i18n "copyrightLink" }}</span>{{ i18n "colon" }}<a href="{{ . }}" target="_blank">{{ . }}</a></li>
{{ end }}
{{ end }}
{{ with $author.copyright }}
Expand Down
6 changes: 3 additions & 3 deletions themes/tianheg/layouts/partials/components/post-gitinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{{ if .Site.Params.displayCommitHash }}
<div class="gitinfo-item commit">
{{- with .Site.Params.repoURL -}}
<a href="{{ . }}/commit/{{ $.GitInfo.Hash }}" target="_blank" rel="noopener">
<a href="{{ . }}/commit/{{ $.GitInfo.Hash }}" target="_blank">
{{- partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.gitIcon "class" "git-icon") -}}
{{- $.GitInfo.AbbreviatedHash -}}
</a>
Expand All @@ -38,7 +38,7 @@
{{ if .Site.Params.displayFeedback }}
{{ with .Site.Params.repoURL }}
<div class="gitinfo-item feedback">
<a href="{{ . }}/issues" target="_blank" rel="noopener">
<a href="{{ . }}/issues" target="_blank">
{{- partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.feedbackIcon "class" "feedback-icon") -}}
{{- $.Site.Params.feedbackText -}}
</a>
Expand All @@ -49,7 +49,7 @@
{{ with .Site.Params.repoEditURL }}
{{ $contentDir := (cond $.Site.IsMultiLingual (printf `/%s/` $.Site.Params.contentDir) "/content/") }}
<div class="gitinfo-item edit">
<a href="{{ . }}{{ $contentDir }}{{ replace $path "\\" "/" }}" target="_blank" rel="noopener">
<a href="{{ . }}{{ $contentDir }}{{ replace $path "\\" "/" }}" target="_blank">
{{- partial "utils/icon.html" (dict "$" $ "name" $.Site.Params.editIcon "class" "edit-icon") -}}
{{- $.Site.Params.editText -}}
</a>
Expand Down
2 changes: 1 addition & 1 deletion themes/tianheg/layouts/partials/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{{ else }}
<li class="menu-item{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{ end }}">
{{- $linkType := (string .Pre) -}}
<a href="{{ .URL }}"{{ if eq $linkType "external" }} target="_blank" rel="external noopener"{{ end }}>
<a href="{{ .URL }}"{{ if eq $linkType "external" }} target="_blank" rel="external"{{ end }}>
{{- $iconName := (string .Post) -}}
{{- partial "utils/icon.html" (dict "$" $ "name" $iconName "class" .Identifier) -}}
{{- with .Name -}}
Expand Down
2 changes: 1 addition & 1 deletion themes/tianheg/layouts/partials/pages/home-footage.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h1>{{ .Site.Params.homeTitle }}</h1>
{{ range $index, $value := . }}
{{- $linkType := (string .Pre) -}}
{{- $iconName := (string .Post) -}}
<a href="{{ .URL }}"{{ if eq $linkType "external" }} target="_blank" rel="external noopener"{{ end }}>{{ partial "utils/icon.html" (dict "$" $ "name" $iconName "class" .Identifier) }}{{ .Name }}</a>
<a href="{{ .URL }}"{{ if eq $linkType "external" }} target="_blank" rel="external"{{ end }}>{{ partial "utils/icon.html" (dict "$" $ "name" $iconName "class" .Identifier) }}{{ .Name }}</a>
{{- if lt $index $length -}}
{{- $.Site.Params.homeLinksDelimiter -}}
{{- end -}}
Expand Down
4 changes: 2 additions & 2 deletions themes/tianheg/layouts/partials/pages/home-poetry.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
{{ range . }}
{{- $linkType := (string .Pre) -}}
{{- $iconName := (string .Post) -}}
<a href="{{ .URL }}" class="links-item"{{ if eq $linkType "external" }} target="_blank" rel="noopener"{{ end }}>{{ partial "utils/icon.html" (dict "$" $ "name" $iconName "class" .Identifier) }}{{ .Name }}</a>
<a href="{{ .URL }}" class="links-item"{{ if eq $linkType "external" }} target="_blank"{{ end }}>{{ partial "utils/icon.html" (dict "$" $ "name" $iconName "class" .Identifier) }}{{ .Name }}</a>
{{ end }}
</div>
{{ end }}
</main>
{{ partial "footer.html" . }}
{{ partial "footer.html" . }}

0 comments on commit e5d552c

Please sign in to comment.