1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-22 16:11:17 -04:00

clean up partials and styles

This commit is contained in:
2020-01-03 13:58:48 -05:00
parent 5b0c24dbf0
commit ec713f5efe
19 changed files with 35 additions and 34 deletions

View File

@@ -0,0 +1,37 @@
<meta property="og:title" content="{{ .Title }}">
<meta property="og:site_name" content="{{ .Site.Title }}">
<meta property="og:type" content="{{ if and .IsPage (eq .Type "notes") }}article{{ else }}website{{ end }}">
<meta property="og:locale" content="en_US">
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
<meta property="og:image" content="{{ .Scratch.Get "socialImage_url" }}">
<meta property="og:image:width" content="{{ .Scratch.Get "socialImage_width" }}">
<meta property="og:image:height" content="{{ .Scratch.Get "socialImage_height" }}">
<meta property="og:image:alt" content="{{ .Title }}">
{{- if and .IsPage (eq .Type "notes") }}
{{- 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 }}
{{- with .Params.tags }}{{ range . }}
<meta property="article:tag" content="{{ . }}">{{ end }}{{ end }}
{{- end }}
{{ with .Site.Author.facebookid }}<meta property="fb:admins" content="{{ . }}">{{ end }}
{{ with .Site.Params.facebookappid }}<meta property="fb:app_id" content="{{ . }}">{{ end }}
<meta name="twitter:card" content="{{ if .IsPage }}summary_large_image{{ else }}summary{{ end }}">
<meta name="twitter:domain" content="{{ .Site.Params.domain }}">
{{- with .Site.Author.twitter }}
<meta name="twitter:site" content="{{ printf "%s%s" "@" . }}">
<meta name="twitter:creator" content="{{ printf "%s%s" "@" . }}">
{{- end }}
{{ with .Site.Author.twitterid }}<meta name="twitter:creator_id" content="{{ . }}">{{ end }}
<meta name="twitter:dnt" content="on">

View File

@@ -0,0 +1,35 @@
<script type="application/ld+json">
{
"@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" }},
"keywords": {{ with .Params.tags }}{{ delimit . ", " }}{{ end }},
"description": {{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }},
"wordCount": "{{ .WordCount }}",
"author": {
"@id": {{ printf "%s%s" .Site.BaseURL "#author" }}
},
"publisher": {
"@type": "Organization",
"name": {{ .Site.Title }},
"url": {{ .Site.BaseURL }},
"logo": {
"@type": "ImageObject",
"url": {{ .Scratch.Get "logoImage_url" }},
"width": "{{ .Scratch.Get "logoImage_width" }}",
"height": "{{ .Scratch.Get "logoImage_height" }}"
}
},
"image": {
"@type": "ImageObject",
"url": {{ .Scratch.Get "socialImage_url" }},
"width": "{{ .Scratch.Get "socialImage_width" }}",
"height": "{{ .Scratch.Get "socialImage_height" }}"
}
}
</script>

View File

@@ -0,0 +1,28 @@
{{- with .Site.Author -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Person",
"@id": {{ printf "%s%s" $.Site.BaseURL "#author" }},
"name": {{ $.Site.Author.name }},
"url": {{ $.Site.BaseURL }},
"description": {{ $.Site.Params.description }},
{{ with .jobtitle }}"jobTitle": {{ . }},{{ end }}
"image": {
"@type": "ImageObject",
"url": {{ $.Scratch.Get "defaultImage_url" }},
"width": "{{ $.Scratch.Get "defaultImage_width" }}",
"height": "{{ $.Scratch.Get "defaultImage_height" }}"
},
"sameAs": [
{{ $.Site.BaseURL }},
{{ with .github }}{{ printf "%s%s" "https://github.com/" . }},{{ end }}
{{ with .twitter }}{{ printf "%s%s" "https://twitter.com/" . }},{{ end }}
{{ with .linkedin }}{{ printf "%s%s%s" "https://www.linkedin.com/in/" . "/" }},{{ end }}
{{ with .facebook }}{{ printf "%s%s" "https://www.facebook.com/" . }},{{ end }}
{{ with .instagram }}{{ printf "%s%s%s" "https://www.instagram.com/" . "/" }},{{ end }}
{{ with .mastodon }}{{ printf "%s%s" "https://" . }}{{ end }}
]
}
</script>
{{- end -}}

View File

@@ -0,0 +1,32 @@
{{- /* Default image */ -}}
{{- $defaultImagePath := (path.Join "content" $.Site.Params.defaultimage) }}
{{- $.Scratch.Set "defaultImage_url" (replace $defaultImagePath "content/" $.Site.BaseURL) }}
{{- with (imageConfig $defaultImagePath) }}
{{- $.Scratch.Set "defaultImage_width" .Width }}
{{- $.Scratch.Set "defaultImage_height" .Height }}
{{- end }}
{{- /* Article image (with fallback to default image */ -}}
{{- with .Params.image }}
{{- $imagePath := (path.Join "content" $.File.Dir "images/" .) }}
{{- $.Scratch.Set "socialImage_url" (replace $imagePath "content/" $.Site.BaseURL) }}
{{- with (imageConfig $imagePath) }}
{{- $.Scratch.Set "socialImage_width" .Width }}
{{- $.Scratch.Set "socialImage_height" .Height }}
{{- end }}
{{- else }}
{{- $.Scratch.Set "socialImage_url" (replace $defaultImagePath "content/" $.Site.BaseURL) }}
{{- with (imageConfig $defaultImagePath) }}
{{- $.Scratch.Set "socialImage_width" .Width }}
{{- $.Scratch.Set "socialImage_height" .Height }}
{{- end }}
{{- end }}
{{- /* Site logo */ -}}
{{- $logoImagePath := (path.Join "content" "logo.png") }}
{{- $.Scratch.Set "logoImage_url" (replace $logoImagePath "content/" $.Site.BaseURL) }}
{{- with (imageConfig $logoImagePath) }}
{{- $.Scratch.Set "logoImage_width" .Width }}
{{- $.Scratch.Set "logoImage_height" .Height }}
{{- end }}