1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 16:05:31 -04:00

switch everything from messy hCards/microdata to JSON-LD

This commit is contained in:
2019-11-22 20:24:38 -05:00
parent cf3e2ca5cf
commit 1ea90613c9
9 changed files with 68 additions and 29 deletions

View File

@@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
{{ hugo.Generator }}
<title>{{ .Title }}{{ if not .IsHome }} &ndash; {{ .Site.Title }}{{ end }} &#x1f468;&#x200d;&#x1f4bb;</title>
<title>{{ .Title }}{{ if not .IsHome }} &ndash; {{ .Site.Title }}{{ else }} &#x1f468;&#x200d;&#x1f4bb;{{ end }}</title>
<meta name="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Params.description }}{{ end }}">
<meta name="author" content="{{ .Site.Author.name }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -23,10 +23,15 @@
<link rel="icon" href="{{ "favicon-16.png" | absURL }}" sizes="16x16">
<link rel="shortcut icon" href="{{ "favicon.ico" | absURL }}">
<link rel="canonical" href="{{ .Permalink }}">
{{- if and (eq .Type "notes") (eq .Kind "page") }}{{ with .OutputFormats.Get "amp" }}
<link rel="amphtml" href="{{ .Permalink }}">
{{- end }}{{ end }}
<link rel="alternate" type="application/rss+xml" href="{{ "index.xml" | absURL }}" title="{{ .Site.Title }} (RSS)">
<link rel="author" href="{{ "humans.txt" | absURL }}">
{{ if and (eq .Type "notes") (eq .Kind "page") }}
{{ with .OutputFormats.Get "amp" }}
<link rel="amphtml" href="{{ .Permalink }}">
{{ end }}
{{ partial "schema-article.html" . }}
{{ else }}
{{ partial "schema-person.html" . }}
{{ end }}
</head>
<body id="{{ .Type }}">

View File

@@ -4,12 +4,14 @@
<meta property="og:locale" content="en_US">
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Params.description }}{{ end }}">
<meta property="og:image" content="{{ if .Params.image }}{{ (printf "%s%s%s" (.OutputFormats.Get "html").Permalink "images/" .Params.image ) }}{{ else }}{{ "me_lg.jpg" | absURL }}{{ end }}">
<meta property="og:image" content="{{ if .Params.image }}{{ (printf "%s%s%s" (.OutputFormats.Get "html").Permalink "images/" .Params.image ) }}{{ else }}{{ "me_lg.jpg" | absURL }}{{ end }}">
{{- if .IsPage }}
{{- if not .PublishDate.IsZero }}
<meta property="article:published_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTMLAttr }}">
<meta property="article:modified_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTMLAttr }}">
{{- else if not .Date.IsZero }}
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTMLAttr }}">
<meta property="article:modified_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTMLAttr }}">
{{- end }}
{{- with .Site.Author.facebook }}
<meta property="article:author" content="https://www.facebook.com/{{ . }}">{{ end }}
@@ -20,7 +22,7 @@
<meta property="fb:app_id" content="{{ .Site.Params.facebook_app_id }}">
<meta name="twitter:card" content="summary">
<meta name="twitter:domain" content="{{ .Site.Params.domain }}">
<meta name="twitter:site" content="{{ .Site.Author.twitter }}">
<meta name="twitter:creator" content="{{ .Site.Author.twitter }}">
<meta name="twitter:site" content="{{ printf "%s%s" "@" .Site.Author.twitter }}">
<meta name="twitter:creator" content="{{ printf "%s%s" "@" .Site.Author.twitter }}">
<meta name="twitter:dnt" content="on">
<meta name="twitter:widgets:csp" content="on">

View File

@@ -2,7 +2,9 @@
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"url": {{ with .OutputFormats.Get "html" }}{{ .Permalink }}{{ end }},
"mainEntityOfPage": {{ with .OutputFormats.Get "html" }}{{ .Permalink }}{{ end }},
"name": {{ .Title }},
"headline": {{ .Title }},
"datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }},
"dateModified": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }},
@@ -32,7 +34,7 @@
},
"image": {
"@type": "ImageObject",
"url": {{ if .Params.image }}{{ (printf "%s%s%s" (.OutputFormats.Get "html").Permalink "images/" .Params.image ) }}{{ else }}{{ "me_lg.jpg" | absURL }}{{ end }}
"url": {{ if .Params.image }}{{ (printf "%s%s%s" (.OutputFormats.Get "html").Permalink "images/" .Params.image ) }}{{ else }}{{ "me_lg.jpg" | absURL }}{{ end }}
}
}
</script>

View File

@@ -0,0 +1,23 @@
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Person",
"name": {{ .Site.Author.name }},
"url": {{ .Site.BaseURL }},
"description": {{ .Site.Params.description }},
"jobTitle": {{ .Site.Author.jobtitle }},
"image": {
"@type": "ImageObject",
"url": {{ "me_lg.jpg" | absURL }},
"width": 920,
"height": 920
},
"sameAs": [
{{ .Site.BaseURL }},
"https://github.com/{{ .Site.Author.github }}",
"https://twitter.com/{{ .Site.Author.twitter }}",
"https://www.facebook.com/{{ .Site.Author.facebook }}",
"https://www.linkedin.com/in/{{ .Site.Author.linkedin }}/"
]
}
</script>