Skip to content

Commit 6d99125

Browse files
committed
Home image
1 parent a2182cb commit 6d99125

2 files changed

Lines changed: 40 additions & 6 deletions

File tree

‎assets/images/social_cover.png‎

446 KB
Loading

‎layouts/partials/head.html‎

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,65 @@
22
<meta name="viewport" content="width=device-width, initial-scale=1.0">
33
<meta http-equiv="X-UA-Compatible" content="IE=edge">
44

5+
{{/* ── Title ── */}}
56
<title>{{ if .IsHome }}{{ .Site.Title }} — {{ .Site.Params.tagline }}{{ else }}{{ .Title }} | {{ .Site.Title }}{{ end }}</title>
6-
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
77

8-
{{/* Resolve og:image from front matter */}}
8+
{{/* ── Description ── */}}
9+
{{ $desc := .Site.Params.description }}
10+
{{ with .Description }}{{ $desc = . }}{{ end }}
11+
<meta name="description" content="{{ $desc }}">
12+
13+
{{/* ── Author ── */}}
14+
{{ with .Params.author }}<meta name="author" content="{{ . }}">{{ end }}
15+
16+
{{/* ── Robots ── */}}
17+
<meta name="robots" content="index, follow">
18+
19+
{{/* ── OG image: front matter → default social cover ── */}}
920
{{ $ogImage := "" }}
1021
{{ with .Params.image }}
1122
{{ $ogImage = absURL . }}
23+
{{ else }}
24+
{{ $cover := resources.Get "images/social_cover.png" }}
25+
{{ if $cover }}
26+
{{ $ogImage = ($cover | fingerprint).Permalink }}
27+
{{ end }}
1228
{{ end }}
1329

30+
{{/* ── Open Graph ── */}}
1431
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}">
32+
<meta property="og:site_name" content="{{ .Site.Title }}">
1533
<meta property="og:title" content="{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }}{{ end }}">
16-
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
34+
<meta property="og:description" content="{{ $desc }}">
1735
<meta property="og:url" content="{{ .Permalink }}">
18-
<meta property="og:site_name" content="{{ .Site.Title }}">
19-
{{ with $ogImage }}<meta property="og:image" content="{{ . }}">{{ end }}
36+
<meta property="og:locale" content="en_US">
37+
{{ with $ogImage }}
38+
<meta property="og:image" content="{{ . }}">
39+
<meta property="og:image:width" content="1200">
40+
<meta property="og:image:height" content="630">
41+
{{ end }}
42+
43+
{{/* ── Article meta (blog posts only) ── */}}
44+
{{ if and .IsPage (eq .Section "blog") }}
45+
{{ with .Date }}<meta property="article:published_time" content="{{ .Format "2006-01-02T15:04:05Z07:00" }}">{{ end }}
46+
{{ with .Lastmod }}<meta property="article:modified_time" content="{{ .Format "2006-01-02T15:04:05Z07:00" }}">{{ end }}
47+
{{ with .Params.author }}<meta property="article:author" content="{{ . }}">{{ end }}
48+
{{ range .Params.tags }}<meta property="article:tag" content="{{ . }}">{{ end }}
49+
{{ end }}
2050

51+
{{/* ── Twitter Card ── */}}
2152
<meta name="twitter:card" content="{{ if $ogImage }}summary_large_image{{ else }}summary{{ end }}">
2253
<meta name="twitter:title" content="{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }}{{ end }}">
23-
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
54+
<meta name="twitter:description" content="{{ $desc }}">
2455
{{ with $ogImage }}<meta name="twitter:image" content="{{ . }}">{{ end }}
2556
{{ with .Site.Params.social.twitter }}<meta name="twitter:site" content="@{{ . }}">{{ end }}
2657

58+
{{/* ── Canonical ── */}}
2759
<link rel="canonical" href="{{ .Permalink }}">
2860

61+
{{/* ── Styles ── */}}
2962
{{ $scss := resources.Get "scss/main.scss" | toCSS (dict "targetPath" "css/main.css" "enableSourceMap" false "outputStyle" "compressed") | fingerprint }}
3063
<link rel="stylesheet" href="{{ $scss.RelPermalink }}">
3164

65+
{{/* ── Favicon ── */}}
3266
<link rel="icon" type="image/svg+xml" href="/favicon.svg">

0 commit comments

Comments
 (0)