Skip to content

Commit 1914f3a

Browse files
committed
Add experimental OpenGraph metadata
1 parent 80e841d commit 1914f3a

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.project
22
target/
33
/.hugo/public/
4+
/.hugo/resources/
45
/.hugo/.hugo_build.lock
616 KB
Binary file not shown.

.hugo/assets/img/opengraph.png

42.5 KB
Loading

.hugo/layouts/partials/header.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
{{ with .Params.description -}}
1616
<meta name="description" content="{{ . }}">
1717
{{- end }}
18+
{{- partial "opengraph.html" . }}
1819
</head>
1920
<body>
2021
<div class="header-bar">
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- $font := resources.Get "fonts/noto-sans-700.ttf" -}}
2+
{{- $image := resources.Get "img/opengraph.png" -}}
3+
{{- $image := $image | images.Filter (images.Text .Title (dict "font" $font "color" "#589" "x" 40 "y" 320 "size" 56)) -}}
4+
{{- $image := $image | resources.Copy ( path.Join .Path "opengraph.png" ) -}}
5+
<meta property="og:url" content="{{ .Permalink }}">
6+
<meta property="og:type" content="website">
7+
<meta property="og:site_name" content="The Java Version Almanac">
8+
<meta property="og:title" content="{{ .Title }}">
9+
{{ with .Params.description -}}
10+
<meta property="og:description" content="{{ . }}">
11+
{{- end }}
12+
<meta property="og:image" content="{{ $image.Permalink }}">

0 commit comments

Comments
 (0)