Add site schema for SEO
This commit is contained in:
parent
0b156ce731
commit
2fe5c9b36b
@ -1,6 +1,9 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="{{ .Lang }}">
|
<html lang="{{ .Lang }}">
|
||||||
{{ partial "head.html" . }}
|
<head>
|
||||||
|
{{ partial "head.html" . }}
|
||||||
|
{{ partial "site-schema.html" . }}
|
||||||
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{ partial "nav.html" . }}
|
{{ partial "nav.html" . }}
|
||||||
{{ block "header" . }}{{ partial "header.html" . }}{{ end }}
|
{{ block "header" . }}{{ partial "header.html" . }}{{ end }}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
{{- $.Scratch.Set "Description" ( .Description | default .Params.subtitle | default .Summary ) }}
|
{{- $.Scratch.Set "Description" ( .Description | default .Params.subtitle | default .Summary ) }}
|
||||||
{{- $.Scratch.Set "Title" ( .Title | default .Site.Title ) }}
|
{{- $.Scratch.Set "Title" ( .Title | default .Site.Title ) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||||
@ -60,12 +60,7 @@
|
|||||||
<!-- Hugo Version number -->
|
<!-- Hugo Version number -->
|
||||||
{{ .Hugo.Generator -}}
|
{{ .Hugo.Generator -}}
|
||||||
<!-- Links and stylesheets -->
|
<!-- Links and stylesheets -->
|
||||||
<link rel="canonical" href="{{ .URL | absLangURL }}" />
|
<link rel="alternate" href="{{ "index.xml" | absLangURL }}" type="application/rss+xml" title="{{ .Site.Title }}">
|
||||||
{{- if .RSSLink }}
|
|
||||||
<link rel="alternate" href="{{ .RSSLink }}" type="application/rss+xml" title="{{ .Site.Title }}">
|
|
||||||
{{- else }}
|
|
||||||
<link rel="alternate" href="{{ .Site.RSSLink }}" type="application/rss+xml" title="{{ .Site.Title }}">
|
|
||||||
{{- end }}
|
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
@ -91,4 +86,3 @@
|
|||||||
|
|
||||||
{{- partial "head_custom.html" . }}
|
{{- partial "head_custom.html" . }}
|
||||||
{{ template "_internal/google_analytics_async.html" . }}
|
{{ template "_internal/google_analytics_async.html" . }}
|
||||||
</head>
|
|
||||||
|
73
layouts/partials/site-schema.html
Normal file
73
layouts/partials/site-schema.html
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
{{ if .IsHome -}}
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context": "http://schema.org",
|
||||||
|
"@type": "WebSite",
|
||||||
|
"url": "{{ .Site.BaseURL }}",
|
||||||
|
{{ if .Site.Author.name -}}
|
||||||
|
"author": {
|
||||||
|
"@type": "Person",
|
||||||
|
"name": "{{ .Site.Author.name }}"
|
||||||
|
},
|
||||||
|
{{- end }}
|
||||||
|
{{ if .Site.Params.description -}}
|
||||||
|
"description": "{{ .Site.Params.description }}",
|
||||||
|
{{- end }}
|
||||||
|
{{ if .Site.Params.logo -}}
|
||||||
|
"image": "{{ .Site.Params.logo | absURL }}",
|
||||||
|
{{- end }}
|
||||||
|
{{ with .Site.Copyright -}}
|
||||||
|
"license": "{{ . }}",
|
||||||
|
{{- end }}
|
||||||
|
"name": "{{ .Site.Title }}"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{{- else if .IsPage -}}
|
||||||
|
<script type="application/ld+json"> {
|
||||||
|
"@context" : "http://schema.org",
|
||||||
|
"@type" : "BlogPosting",
|
||||||
|
{{ if .Params.categories }}{{ range .Params.categories }}"articleSection" : "{{ . }}",{{ end }}{{ end }}
|
||||||
|
"name" : "{{ .Title | safeJS }}",
|
||||||
|
"headline" : "{{ .Title | safeJS }}",
|
||||||
|
"mainEntityOfPage": {
|
||||||
|
"@type": "WebPage",
|
||||||
|
"@id": "{{ .Permalink }}"
|
||||||
|
},
|
||||||
|
"description" : "{{ if .Description }}{{ .Description | plainify }}{{ else }}{{if .IsPage}}{{ .Summary | plainify }}{{ end }}{{ end }}",
|
||||||
|
"inLanguage" : "{{ .Lang }}",
|
||||||
|
{{ if .Params.author -}}
|
||||||
|
"author": {
|
||||||
|
"@type": "Person",
|
||||||
|
"name": "{{ .Params.author }}"
|
||||||
|
},
|
||||||
|
{{- else if .Site.Author.name -}}
|
||||||
|
"author": {
|
||||||
|
"@type": "Person",
|
||||||
|
"name": "{{ .Site.Author.name }}"
|
||||||
|
},
|
||||||
|
{{- end }}
|
||||||
|
"copyrightYear" : "{{ .Site.Params.since }} - {{ .Site.LastChange.Format "2006" }}",
|
||||||
|
{{ if not .PublishDate.IsZero -}}
|
||||||
|
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}",
|
||||||
|
{{- else if not .Date.IsZero -}}
|
||||||
|
"datePublished": "{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}",
|
||||||
|
{{- end }}
|
||||||
|
{{ with .Lastmod -}}
|
||||||
|
"dateModified": "{{ .Format "2006-01-02T15:04:05-07:00" | safeHTML }}",
|
||||||
|
{{- end }}
|
||||||
|
"url" : "{{ .Permalink }}",
|
||||||
|
"wordCount" : "{{ .WordCount }}",
|
||||||
|
"image" : "{{ .Site.Params.logo | absURL }}",
|
||||||
|
"keywords" : [ "{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}" ],
|
||||||
|
"publisher" : {
|
||||||
|
"@type": "Organization",
|
||||||
|
"name" : "{{ .Site.BaseURL }}",
|
||||||
|
"logo" : {
|
||||||
|
"@type" : "ImageObject",
|
||||||
|
"url" : "{{ .Site.Params.logo | absURL }}",
|
||||||
|
"height" : 60 ,
|
||||||
|
"width" : 60
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} </script>
|
||||||
|
{{ end }}
|
Loading…
x
Reference in New Issue
Block a user