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

clean up a bunch of layouts, especially social-images function

also made even more config.toml parameters optional, will help when finally releasing theme
This commit is contained in:
2020-06-25 10:35:59 -04:00
parent 0a48ce296f
commit f3198e0235
31 changed files with 167 additions and 162 deletions

View File

@@ -2,13 +2,13 @@
{{ partial "functions/social-images" . -}}
{{ partial "head/open-graph" . -}}
{{ partialCached "head/mobile" . -}}
{{ partial "head/preload" . -}}
{{ partialCached "head/preload" . -}}
{{ partial "head/styles" . -}}
{{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32 48") -}}
{{ partialCached "head/feeds" . -}}
{{ partialCached "head/webmention" . -}}
{{ partial "head/canonical" . -}}
{{ partial "head/schema" . -}}
{{ if eq hugo.Environment "production" }}
{{ partial "scripts/simple_analytics_events" . -}}
{{ end }}
{{ if eq hugo.Environment "production" -}}
{{ partialCached "scripts/simple_analytics_events" . -}}
{{ end -}}

View File

@@ -1,7 +1,7 @@
<link rel="canonical" href="{{ .Permalink }}">
{{ if and .IsPage (eq .Type .Site.Params.mainSection) }}
{{- with .OutputFormats.Get "amp" -}}
<link rel="amphtml" href="{{ .Permalink }}">
<link rel="amphtml" href="{{ .Permalink }}">
{{ end -}}
{{ end -}}
<link rel="author" href="{{ "humans.txt" | absURL }}">

View File

@@ -7,10 +7,10 @@
{{- range (split .pngSizes " ") }}
{{- $faviconPng := resources.Get (printf "img/favicon-%v.png" .) }}
<link rel="icon" href="{{ $faviconPng.Permalink }}" sizes="{{ . }}x{{ . }}">
{{- end }}
{{- end -}}
{{- $s := slice }}
{{- range (split .icoSizes " ") }}{{ $s = $s | append (printf "%vx%v" . .) }}{{ end }}
{{- $s := slice -}}
{{- range (split .icoSizes " ") }}{{ $s = $s | append (printf "%vx%v" . .) }}{{ end -}}
{{- $faviconIco := resources.Get "img/favicon.ico" }}
<link rel="shortcut icon" href="{{ $faviconIco.Permalink }}" sizes="{{ delimit $s " " }}">

View File

@@ -5,11 +5,13 @@
<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" | absURL }}">
<meta property="og:image:type" content="{{ .Scratch.Get "socialImage_type" }}">
<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 }}">
{{- with .Scratch.Get "pageImage" }}
<meta property="og:image" content="{{ .Permalink }}">
<meta property="og:image:type" content="{{ .MediaType }}">
<meta property="og:image:width" content="{{ .Width }}">
<meta property="og:image:height" content="{{ .Height }}">
<meta property="og:image:alt" content="{{ $.Title }}">
{{ end -}}
{{- if and .IsPage (eq .Type .Site.Params.mainSection) }}
{{- if not .PublishDate.IsZero }}
@@ -23,16 +25,16 @@
<meta property="article:author" content="https://www.facebook.com/{{ . }}">{{ end }}
{{- with .Params.tags }}{{ range . }}
<meta property="article:tag" content="{{ . }}">{{ end }}{{ 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 }}">
<meta name="twitter:domain" content="{{ (urls.Parse .Site.BaseURL).Host }}">
{{- with .Site.Author.twitter }}
<meta name="twitter:site" content="{{ printf "%s%s" "@" . }}">
<meta name="twitter:creator" content="{{ printf "%s%s" "@" . }}">
{{- end }}
{{ end -}}
{{ with .Site.Author.twitterid }}<meta name="twitter:creator_id" content="{{ . }}">{{ end }}
<meta name="twitter:dnt" content="on">

View File

@@ -1,6 +1,5 @@
{{ partial "head/schema/person" . -}}
{{ if and .IsPage (eq .Type .Site.Params.mainSection) }}
{{ partial "head/schema/person" . }}
{{ partial "head/schema/article" . }}
{{ else }}
{{ partial "head/schema/person" . }}
{{ partial "head/schema/article" . -}}
{{ end -}}

View File

@@ -17,19 +17,19 @@
"publisher": {
"@type": "Organization",
"name": {{ .Site.Title }},
"url": {{ .Site.BaseURL }},
"url": {{ .Site.BaseURL }}{{ with .Scratch.Get "logoImage" }},
"logo": {
"@type": "ImageObject",
"url": {{ .Scratch.Get "logoImage_url" | absURL }},
"width": "{{ .Scratch.Get "logoImage_width" }}",
"height": "{{ .Scratch.Get "logoImage_height" }}"
}
},
"url": {{ .Permalink }},
"width": "{{ .Width }}",
"height": "{{ .Height }}"
}{{ end }}
}{{ with .Scratch.Get "pageImage" }},
"image": {
"@type": "ImageObject",
"url": {{ .Scratch.Get "socialImage_url" | absURL }},
"width": "{{ .Scratch.Get "socialImage_width" }}",
"height": "{{ .Scratch.Get "socialImage_height" }}"
}
"url": {{ .Permalink }},
"width": "{{ .Width }}",
"height": "{{ .Height }}"
}{{ end }}
}
</script>

View File

@@ -7,13 +7,13 @@
"name": {{ .name }},
"url": {{ $.Site.BaseURL }},
"description": {{ $.Site.Params.description }},
{{ with .jobtitle }}"jobTitle": {{ . }},{{ end }}
{{ with .jobtitle }}"jobTitle": {{ . }},{{ end }}{{ with $.Scratch.Get "authorImage" }}
"image": {
"@type": "ImageObject",
"url": {{ $.Scratch.Get "defaultImage_url" | absURL }},
"width": "{{ $.Scratch.Get "defaultImage_width" }}",
"height": "{{ $.Scratch.Get "defaultImage_height" }}"
},
"url": {{ .Permalink }},
"width": "{{ .Width }}",
"height": "{{ .Height }}"
},{{ end }}
"sameAs": [
{{ $.Site.BaseURL }},
{{ with .github }}{{ printf "%s%s" "https://github.com/" . }},{{ end }}

View File

@@ -2,9 +2,9 @@
<link rel="stylesheet" href="{{ $style.Permalink }}">
{{/* Page-specific styles set via front matter, scoped via SCSS and inlined */}}
{{ with .Params.css }}
{{- with .Params.css -}}
{{/* NOTE: This file doesn't end up getting published (which is good) */}}
{{- $target := path.Join $.File.Dir "css/inline.scss" }}
{{- $target := path.Join $.File.Dir "css/inline.scss" -}}
{{- $css := . | resources.FromString $target | resources.ToCSS | resources.PostCSS (dict "config" "postcss.config.js") -}}
{{/* Already being minified to my taste by PostCSS above */}}
@@ -13,4 +13,4 @@
{{ $css.Content | safeCSS }}
</style>
{{- printf "<!-- htmlmin:ignore -->" | safeHTML }}
{{ end }}
{{ end -}}

View File

@@ -1,4 +1,4 @@
{{ with .Site.Params.webmention }}
{{ with .Site.Params.webmentionIO }}
<link rel="pingback" href="https://webmention.io/{{ . }}/xmlrpc">
<link rel="webmention" href="https://webmention.io/{{ . }}/webmention">
{{ end }}