mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-19 04:35:31 -04:00
re-organize a bunch of partials
This commit is contained in:
8
layouts/partials/head/favicons.html
Normal file
8
layouts/partials/head/favicons.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<link rel="apple-touch-icon" href="{{ "apple-touch-icon.png" | absURL }}">
|
||||
<link rel="mask-icon" href="{{ "safari-pinned-tab.svg" | absURL }}" color="#009cdf">
|
||||
|
||||
{{ range (split .png_sizes " ") -}}
|
||||
<link rel="icon" href="{{ (printf "favicon-%v.png" .) | absURL }}" sizes="{{ . }}x{{ . }}">
|
||||
{{ end -}}
|
||||
|
||||
<link rel="shortcut icon" href="{{ "favicon.ico" | absURL }}" sizes="{{ .ico_sizes }}">
|
22
layouts/partials/head/head.html
Normal file
22
layouts/partials/head/head.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{ partial "head/meta" . }}
|
||||
{{ partial "head/social-images" . }}
|
||||
{{ partial "head/open-graph" . }}
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
||||
<meta name="apple-mobile-web-app-title" content="{{ .Site.Title }}">
|
||||
<meta name="theme-color" content="#0e6dc2">
|
||||
{{ partialCached "head/preload" . }}
|
||||
{{ partialCached "head/styles" . }}
|
||||
{{ partialCached "head/favicons" (dict "png_sizes" "192 48 32 16" "ico_sizes" "16x16 32x32 48x48") }}
|
||||
<link rel="canonical" href="{{ .Permalink }}">
|
||||
<link rel="alternate" type="application/rss+xml" href="{{ "feed.xml" | absURL }}" title="{{ .Site.Title }} (RSS)">
|
||||
<link rel="author" href="{{ "humans.txt" | absURL }}">
|
||||
{{ if and .IsPage (eq .Type "notes") }}
|
||||
{{ with .OutputFormats.Get "amp" }}
|
||||
<link rel="amphtml" href="{{ .Permalink }}">
|
||||
{{ end }}
|
||||
{{ partial "head/schema-person" . }}
|
||||
{{ partial "head/schema-article" . }}
|
||||
{{ else }}
|
||||
{{ partial "head/schema-person" . }}
|
||||
{{ end }}
|
6
layouts/partials/head/meta.html
Normal file
6
layouts/partials/head/meta.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<meta charset="utf-8">
|
||||
{{ hugo.Generator }}
|
||||
<title>{{ .Title }}{{ if not .IsHome }} – {{ .Site.Title }}{{ else }} 👨‍💻{{ end }}</title>
|
||||
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
|
||||
{{ with .Site.Author.name }}<meta name="author" content="{{ . }}">{{ end }}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
37
layouts/partials/head/open-graph.html
Normal file
37
layouts/partials/head/open-graph.html
Normal 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">
|
3
layouts/partials/head/preload.html
Normal file
3
layouts/partials/head/preload.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<link rel="preload" href="{{ "fonts/roboto-latin-regular.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="{{ "fonts/roboto-latin-medium.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="{{ "fonts/roboto-latin-bold.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
|
35
layouts/partials/head/schema-article.html
Normal file
35
layouts/partials/head/schema-article.html
Normal 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>
|
28
layouts/partials/head/schema-person.html
Normal file
28
layouts/partials/head/schema-person.html
Normal 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 -}}
|
32
layouts/partials/head/social-images.html
Normal file
32
layouts/partials/head/social-images.html
Normal 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 }}
|
2
layouts/partials/head/styles.html
Normal file
2
layouts/partials/head/styles.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS (dict "targetPath" "style.css") | resources.PostCSS (dict "config" "postcss.config.js") }}
|
||||
<link rel="stylesheet" href="{{ $style.Permalink }}">
|
Reference in New Issue
Block a user