Skip to content

Commit

Permalink
More OpenGraph fields
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarWatcher committed Dec 25, 2024
1 parent a9dd079 commit 89faac4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: single
title: Home
description:
ogprofile: ["Olivia", "", "female", "LunarWatcher"]
---

# About me
Expand Down
24 changes: 24 additions & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,30 @@
{{ end }}
<meta property="og:site_name" content="{{ .Site.Title }}" />
<meta property="og:locale" content="{{ .Site.LanguageCode }}" />
{{ if (and (or (eq .Section "til") (eq .Section "posts")) (.IsPage)) }}
<meta property="og:type" content="article" />
<meta property="article:author" content="{{ "/" | absURL }}" />

{{ $taxonomy := "tags" }}
{{ with (sort (.Param $taxonomy) ) }}
{{ range $index, $tag := . }}
<meta property="og:tag" content="{{ $tag }}" />
{{ end }}
{{ end }}
{{ end }}

{{ if isset .Params "ogprofile" }}
<!-- Required for og:author to function properly -->
{{ $fn := index (.Params.ogprofile) 0 }}
{{ $g := index (.Params.ogprofile) 2 }}
{{ $un := index (.Params.ogprofile) 3 }}

<meta property="profile:first_name" content="{{ $fn }}" />
<meta property="profile:gender" content="{{ $g }}" />
<meta property="profile:username" content="{{ $un }}" />

{{ end }}

<!-- ))) -->
<!--
vim:fmr=(((,)))
Expand Down

0 comments on commit 89faac4

Please sign in to comment.