Skip to content

Commit

Permalink
feat: Canonical URL on header (#335)
Browse files Browse the repository at this point in the history
Close #322
  • Loading branch information
peaceiris authored May 9, 2021
1 parent d462238 commit 85f139b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ edit:
other: Edit
view_on_github:
other: View Source
canonical_link:
other: Originally published at
2 changes: 2 additions & 0 deletions i18n/ja.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ edit:
other: 編集
view_on_github:
other: ソースを表示
canonical_link:
other: 元記事は
4 changes: 4 additions & 0 deletions layouts/partials/canonical-link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{ with $.Page.Params.canonicalURL }}
{{ i18n "canonical_link" . }}
<a href="{{ . | safeURL }}" rel="noopener noreferrer" target="_blank">{{ (. | safeURL | urls.Parse).Host }}</a>
{{ end }}
1 change: 1 addition & 0 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ <h1 class="title is-spaced">
{{ if (not $.Site.Params.disableBreadcrumbNavigation) }}
{{ partial "breadcrumb" . }}
{{ end }}
<p class="is-italic has-text-grey-light has-text-weight-light">{{ partial "canonical-link" . }}</p>
<p class="has-text-grey-light is-pulled-right">{{ i18n "lastmod" . }}: {{ .Lastmod.Format "2006-01-02" }}</p>
</div>
</div>
Expand Down

0 comments on commit 85f139b

Please sign in to comment.