mirror of
https://github.com/maikka39/Personal-Website.git
synced 2026-10-24 06:56:59 +00:00
Add JSON-LD for rich results
This commit is contained in:
@@ -40,7 +40,9 @@ googleAnalytics = "UA-136337666-1"
|
|||||||
|
|
||||||
[author]
|
[author]
|
||||||
name = "Maik de Kruif"
|
name = "Maik de Kruif"
|
||||||
|
email = "maik@maik.dev"
|
||||||
twitter = "@maik_dev"
|
twitter = "@maik_dev"
|
||||||
|
image = "/img/home/portrait.png"
|
||||||
|
|
||||||
[social]
|
[social]
|
||||||
twitter = "@maik_dev"
|
twitter = "@maik_dev"
|
||||||
@@ -60,6 +62,8 @@ googleAnalytics = "UA-136337666-1"
|
|||||||
keywords = "Devloper, Software Engineer, Software Developer, Maik, Computer Science, Portfolio, Blog, Maik de Kruif"
|
keywords = "Devloper, Software Engineer, Software Developer, Maik, Computer Science, Portfolio, Blog, Maik de Kruif"
|
||||||
images = [""]
|
images = [""]
|
||||||
|
|
||||||
|
genre = "Blog"
|
||||||
|
|
||||||
showReadingTimeInList = false
|
showReadingTimeInList = false
|
||||||
|
|
||||||
homeSubtitle = "Software Engineering, Linux and Cyber Security"
|
homeSubtitle = "Software Engineering, Linux and Cyber Security"
|
||||||
|
|||||||
@@ -28,6 +28,9 @@
|
|||||||
<!-- Meta tags -->
|
<!-- Meta tags -->
|
||||||
{{- partial "meta-tags.html" . -}}
|
{{- partial "meta-tags.html" . -}}
|
||||||
|
|
||||||
|
<!-- SEO stuff -->
|
||||||
|
{{- partial "seo.html" . -}}
|
||||||
|
|
||||||
<!-- RSS -->
|
<!-- RSS -->
|
||||||
<!-- {{- with .OutputFormats.Get "rss" }}
|
<!-- {{- with .OutputFormats.Get "rss" }}
|
||||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||||
|
|||||||
@@ -0,0 +1,195 @@
|
|||||||
|
|
||||||
|
{{- if .IsHome }}
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context": "http://schema.org",
|
||||||
|
"@type": "WebSite",
|
||||||
|
"inLanguage": "{{ .Site.LanguageCode }}",
|
||||||
|
{{- $img := resources.Get .Site.Params.portrait.path }}
|
||||||
|
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
|
||||||
|
"thumbnailUrl": "{{ $img.Permalink }}",
|
||||||
|
"image": [
|
||||||
|
{
|
||||||
|
"@type": "ImageObject",
|
||||||
|
"url": "{{ $img.Permalink }}",
|
||||||
|
"width": {{ $img.Width }},
|
||||||
|
"height": {{ $img.Height }}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"genre": "{{ .Site.Params.genre }}",
|
||||||
|
"keywords": "{{ .Site.Params.keywords }}{{ if .Params.tags }}{{ range .Params.tags }}, {{ . }}{{ end }}{{ end }}{{ with .Title }}, {{ delimit (split . " ") ", " }}{{ end }}{{ with .Params.Subtitle }}, {{ delimit (split . " ") ", " }}{{ end }}",
|
||||||
|
"url": "{{ .Permalink }}",
|
||||||
|
{{- with .Site.Copyright }}
|
||||||
|
"license": {{ . | safeHTML }},
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Site.Author.name }}
|
||||||
|
{{- range slice "publisher" "author" }}
|
||||||
|
{{ . }}: {
|
||||||
|
"@type": "Person",
|
||||||
|
"name": {{ $.Site.Author.name | safeHTML }},
|
||||||
|
{{- with $.Site.Author.email }}
|
||||||
|
"email": {{ . | safeHTML }},
|
||||||
|
{{- end }}
|
||||||
|
{{- with $.Site.Author.image }}
|
||||||
|
{{- $img := resources.Get . }}
|
||||||
|
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
|
||||||
|
"image": {
|
||||||
|
"@type": "ImageObject",
|
||||||
|
"url": "{{ $img.Permalink }}",
|
||||||
|
"width": {{ $img.Width }},
|
||||||
|
"height": {{ $img.Height }}
|
||||||
|
},
|
||||||
|
{{- end }}
|
||||||
|
"url": "{{ $.Site.BaseURL }}"
|
||||||
|
},
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
"headline": {{ .Site.Title }},
|
||||||
|
"alternativeHeadline": {{ .Site.Params.homeSubtitle }},
|
||||||
|
"description": {{ .Site.Params.description }}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{{- else if .IsPage }}
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context": "http://schema.org",
|
||||||
|
"@type": "BlogPosting",
|
||||||
|
"articleSection": "{{ .Type }}",
|
||||||
|
"headline": "{{ .Title | safeHTML }}",
|
||||||
|
{{- with .Params.Subtitle }}
|
||||||
|
"alternativeHeadline": "{{ . }}",
|
||||||
|
{{- end }}
|
||||||
|
"inLanguage": "{{ .Site.LanguageCode }}",
|
||||||
|
"mainEntityOfPage": {
|
||||||
|
"@type": "WebPage",
|
||||||
|
"@id": "{{ .Permalink }}"
|
||||||
|
},
|
||||||
|
{{- with .Params.cover}}
|
||||||
|
{{- $img := resources.Get (printf "%s" .) }}
|
||||||
|
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
|
||||||
|
"thumbnailUrl": "{{ $img.Permalink }}",
|
||||||
|
"image": [
|
||||||
|
{
|
||||||
|
"@type": "ImageObject",
|
||||||
|
"url": "{{ $img.Permalink }}",
|
||||||
|
"width": {{ $img.Width }},
|
||||||
|
"height": {{ $img.Height }}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{{- end }}
|
||||||
|
"genre": "{{ .Type }}",
|
||||||
|
"keywords": "{{ .Site.Params.keywords }}{{ if .Params.tags }}{{ range .Params.tags }}, {{ . }}{{ end }}{{ end }}{{ with .Title }}, {{ delimit (split . " ") ", " }}{{ end }}{{ with .Params.Subtitle }}, {{ delimit (split . " ") ", " }}{{ end }}",
|
||||||
|
"wordcount": {{ .WordCount }},
|
||||||
|
"url": "{{ .Permalink }}",
|
||||||
|
"datePublished": {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }},
|
||||||
|
{{- if .GitInfo }}
|
||||||
|
"dateModified": {{ dateFormat "2006-01-02T15:04:05-07:00" .GitInfo.AuthorDate.Local | safeHTML }},
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Site.Copyright }}
|
||||||
|
"license": {{ . | safeHTML }},
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Site.Author.name }}
|
||||||
|
{{- range slice "publisher" "author" }}
|
||||||
|
{{ . }}: {
|
||||||
|
"@type": "Person",
|
||||||
|
"name": {{ $.Site.Author.name | safeHTML }},
|
||||||
|
{{- with $.Site.Author.email }}
|
||||||
|
"email": {{ . | safeHTML }},
|
||||||
|
{{- end }}
|
||||||
|
{{- with $.Site.Author.image }}
|
||||||
|
{{- $img := resources.Get . }}
|
||||||
|
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
|
||||||
|
"image": {
|
||||||
|
"@type": "ImageObject",
|
||||||
|
"url": "{{ $img.Permalink }}",
|
||||||
|
"width": {{ $img.Width }},
|
||||||
|
"height": {{ $img.Height }}
|
||||||
|
},
|
||||||
|
{{- end }}
|
||||||
|
"url": "{{ $.Site.BaseURL }}"
|
||||||
|
},
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
"description": {{ .Params.description | plainify }}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{{- else if .IsSection }}
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context": "http://schema.org",
|
||||||
|
"@type": "ItemList",
|
||||||
|
"itemListOrder": "https://schema.org/ItemListOrderDescending",
|
||||||
|
"name": "{{ .Title }}",
|
||||||
|
"numberOfItems": {{ len .Data.Pages }},
|
||||||
|
"itemListElement": [
|
||||||
|
{{- $pages := first 2 .Data.Pages }}
|
||||||
|
{{- range $index, $page := $pages }}
|
||||||
|
{
|
||||||
|
"@type": "ListItem",
|
||||||
|
"position": {{ add $index 1 }},
|
||||||
|
"item": {
|
||||||
|
"@type": "BlogPosting",
|
||||||
|
"articleSection": "{{ .Type }}",
|
||||||
|
"headline": "{{ .Title | safeHTML }}",
|
||||||
|
{{- with .Params.Subtitle }}
|
||||||
|
"alternativeHeadline": "{{ . }}",
|
||||||
|
{{- end }}
|
||||||
|
"inLanguage": "{{ .Site.LanguageCode }}",
|
||||||
|
"mainEntityOfPage": {
|
||||||
|
"@type": "WebPage",
|
||||||
|
"@id": "{{ .Permalink }}"
|
||||||
|
},
|
||||||
|
{{- with .Params.cover}}
|
||||||
|
{{- $img := resources.Get (printf "%s" .) }}
|
||||||
|
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
|
||||||
|
"thumbnailUrl": "{{ $img.Permalink }}",
|
||||||
|
"image": [
|
||||||
|
{
|
||||||
|
"@type": "ImageObject",
|
||||||
|
"url": "{{ $img.Permalink }}",
|
||||||
|
"width": {{ $img.Width }},
|
||||||
|
"height": {{ $img.Height }}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
{{- end }}
|
||||||
|
"genre": "{{ .Type }}",
|
||||||
|
"keywords": "{{ .Site.Params.keywords }}{{ if .Params.tags }}{{ range .Params.tags }}, {{ . }}{{ end }}{{ end }}{{ with .Title }}, {{ delimit (split . " ") ", " }}{{ end }}{{ with .Params.Subtitle }}, {{ delimit (split . " ") ", " }}{{ end }}",
|
||||||
|
"wordcount": {{ .WordCount }},
|
||||||
|
"url": "{{ .Permalink }}",
|
||||||
|
"datePublished": {{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }},
|
||||||
|
{{- if .GitInfo }}
|
||||||
|
"dateModified": {{ dateFormat "2006-01-02T15:04:05-07:00" .GitInfo.AuthorDate.Local | safeHTML }},
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Site.Copyright }}
|
||||||
|
"license": {{ . | safeHTML }},
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Site.Author.name }}
|
||||||
|
{{- range slice "publisher" "author" }}
|
||||||
|
{{ . }}: {
|
||||||
|
"@type": "Person",
|
||||||
|
"name": {{ $.Site.Author.name | safeHTML }},
|
||||||
|
{{- with $.Site.Author.email }}
|
||||||
|
"email": {{ . | safeHTML }},
|
||||||
|
{{- end }}
|
||||||
|
{{- with $.Site.Author.image }}
|
||||||
|
{{- $img := resources.Get . }}
|
||||||
|
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
|
||||||
|
"image": {
|
||||||
|
"@type": "ImageObject",
|
||||||
|
"url": "{{ $img.Permalink }}",
|
||||||
|
"width": {{ $img.Width }},
|
||||||
|
"height": {{ $img.Height }}
|
||||||
|
},
|
||||||
|
{{- end }}
|
||||||
|
"url": "{{ $.Site.BaseURL }}"
|
||||||
|
},
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
"description": {{ .Params.description | plainify }}
|
||||||
|
}
|
||||||
|
}{{ if ne (sub (len $pages) 1) $index }},{{ end }}
|
||||||
|
{{- end }}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{{- end }}
|
||||||
Reference in New Issue
Block a user