-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Override the seo template to make it compatible with hugo >= 0.123
For more information see wjh18/hugo-liftoff#41
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!-- Robots meta --> | ||
{{ if eq .Kind "404" -}} | ||
<meta name="robots" content="noindex, follow"> | ||
{{ else -}} | ||
{{ with .Params.robots -}} | ||
<meta name="robots" content="{{ . }}"> | ||
{{ else -}} | ||
<meta name="robots" content="index, follow"> | ||
<meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"> | ||
<meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"> | ||
{{ end -}} | ||
{{ end -}} | ||
|
||
<!-- SEO title from config or front matter --> | ||
<!-- Site title gets added EXCEPT on single post and project pages --> | ||
<title> | ||
{{- if and .Page.IsNode .Page.Paginator -}} | ||
{{- $paginator := .Paginate .RegularPagesRecursive }} | ||
{{- with $paginator -}} | ||
{{ if and (gt $paginator.TotalPages 1) (gt $paginator.PageNumber 1) }} | ||
| Page {{ $paginator.PageNumber }} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- with .Params.seo_title -}} | ||
{{- . -}} | ||
{{- else -}} | ||
{{- .Title -}} | ||
{{- end -}} | ||
{{ if (or (and (ne .Type "posts") (ne .Type "projects") (not .IsHome)) (and (not .IsPage) (not .IsHome))) }} | {{ .Site.Title -}}{{ end -}} | ||
</title> | ||
|
||
<!-- Author from config --> | ||
{{ with .Params.author -}} | ||
<meta name="author" content="{{ . }}"> | ||
{{ else -}} | ||
<meta name="author" content="{{ .Site.Params.author }}"> | ||
{{ end -}} | ||
|
||
<!-- Description from config or front matter --> | ||
{{ with .Description -}} | ||
<meta name="description" content="{{ . }}"> | ||
{{ else -}} | ||
<meta name="description" content="{{ .Site.Params.description }}"> | ||
{{ end -}} | ||
|
||
{{ if $.Scratch.Get "paginator" }} | ||
<link rel="canonical" href="{{ .Paginator.URL | absURL }}"> | ||
{{ if .Paginator.HasPrev -}} | ||
<link rel="prev" href="{{ .Paginator.Prev.URL | absURL }}"> | ||
{{ end -}} | ||
{{ if .Paginator.HasNext -}} | ||
<link rel="next" href="{{ .Paginator.Next.URL | absURL }}"> | ||
{{ end -}} | ||
{{ else -}} | ||
<link rel="canonical" href="{{ .Permalink }}"> | ||
{{ end -}} | ||
|
||
{{ partial "head/seo/opengraph.html" . }} | ||
{{ partial "head/seo/twitter-cards.html" . }} | ||
|
||
<!-- Add rss+xml functionality --> | ||
{{- with .OutputFormats.Get "rss" -}} | ||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s">` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} | ||
{{- end -}} | ||
|
||
{{ partial "head/seo/structured-data.html" . }} |