Improve SEO content
This commit is contained in:
33
layouts/partials/seo/opengraph.html
Normal file
33
layouts/partials/seo/opengraph.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{{- $title := .Title | default .Site.Title -}}
|
||||
{{- $description := .Description | default .Summary | default .Site.Params.description | default .Site.Title -}}
|
||||
{{- $image := .Params.image | default .Site.Params.seo.default_image | default "/assets/images/og-default.jpg" -}}
|
||||
{{- $image = $image | absURL -}}
|
||||
{{- $url := .Permalink | default .RelPermalink | absURL -}}
|
||||
{{- $siteName := .Site.Title -}}
|
||||
{{- $locale := .Site.Language.Lang | default "en_US" -}}
|
||||
|
||||
<!-- Open Graph / Facebook -->
|
||||
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}">
|
||||
<meta property="og:site_name" content="{{ $siteName }}">
|
||||
<meta property="og:title" content="{{ $title }}">
|
||||
<meta property="og:description" content="{{ $description }}">
|
||||
<meta property="og:url" content="{{ $url }}">
|
||||
<meta property="og:locale" content="{{ $locale }}">
|
||||
<meta property="og:image" content="{{ $image }}">
|
||||
<meta property="og:image:alt" content="{{ $title }}">
|
||||
<meta property="og:image:width" content="1200">
|
||||
<meta property="og:image:height" content="630">
|
||||
|
||||
<!-- Article specific -->
|
||||
{{ if .IsPage }}
|
||||
<meta property="article:section" content="{{ .Section | default "general" }}">
|
||||
<meta property="article:author" content="{{ .Params.author | default .Site.Params.author | default .Site.Title }}">
|
||||
{{ range .Params.tags | default .Site.Params.tags }}
|
||||
<meta property="article:tag" content="{{ . }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<!-- Additional locales for multilingual sites -->
|
||||
{{ range .Translations }}
|
||||
<meta property="og:locale:alternate" content="{{ .Language.Lang | default "en_US" }}">
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user