Skip to content

Commit

Permalink
Simplify SEO metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
frawleyskid committed Nov 12, 2024
1 parent 46ae594 commit 1493571
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 62 deletions.
2 changes: 1 addition & 1 deletion config/_default/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ description: >-
Ace Archive is a curated online archive of asexual and aromantic history.
# Open Graph
images: ["images/logo-card.webp"]
image: "images/logo-padded.webp"
ogLocale: "en_US"
domainTLD: "acearchive.lgbt"
titleHome: "Ace Archive"
Expand Down
41 changes: 2 additions & 39 deletions layouts/partials/head/opengraph.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,42 +28,5 @@
{{ end -}}
{{ end -}}

{{ if eq .Kind "home" -}}
{{ .Scratch.Set "title" .Site.Params.titleHome -}}
{{ else -}}
{{ .Scratch.Set "title" .Title -}}
{{ end -}}

{{ with $.Params.images -}}
{{ range first 6 . -}}
<meta property="og:image" content="{{ $.Permalink }}{{ . }}">
{{ end -}}
{{ else -}}
{{ $images := $.Resources.ByType "image" -}}
{{ $featured := $images.GetMatch "*feature*" -}}
{{ if not $featured -}}
{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}
{{ end -}}
{{ with $featured -}}
<meta property="og:image" content="{{ $featured.Permalink }}"/>
{{ else -}}
{{ with $.Site.Params.images -}}
<meta property="og:image" content="{{ index . 0 | absURL }}"/>
<meta property="og:image:alt" content="{{ $.Site.Params.title }}">
{{ end -}}
{{ end -}}
{{ end -}}

{{ with $.Site.Params.images -}}
{{ $.Scratch.Set "primaryImage" (index . 0 | absURL) -}}
{{ end -}}

{{ with .Params.audio -}}
<meta property="og:audio" content="{{ . | absURL }}">
{{ end -}}

{{ with .Params.videos -}}
{{ range . -}}
<meta property="og:video" content="{{ . | absURL }}">
{{ end -}}
{{ end -}}
<meta property="og:image" content="{{ .Site.Params.image }}">
<meta property="og:image:alt" content="{{ .Site.Params.headerLogoAlt }}">
26 changes: 4 additions & 22 deletions layouts/partials/head/twitter_cards.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="{{ .Site.Params.twitterSite }}">
<meta name="twitter:creator" content="{{ .Site.Params.twitterCreator }}">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="{{ .Site.Params.title }}">
<meta name="twitter:title" content="{{ .Title }}">
<meta name="twitter:description" content="{{ .Description }}">
{{ with $.Params.images -}}
<meta name="twitter:image" content="{{ $.Permalink }}{{ index . 0 }}">
{{ else -}}
{{ $images := $.Resources.ByType "image" -}}
{{ $featured := $images.GetMatch "*feature*" -}}
{{ if not $featured -}}
{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" -}}
{{ end -}}
{{ with $featured -}}
<meta name="twitter:image" content="{{ $featured.Permalink }}">
{{ else -}}
{{ with $.Site.Params.images -}}
<meta name="twitter:image" content="{{ index . 0 | absURL }}">
{{ else -}}
<meta name="twitter:card" content="summary">
{{ end -}}
{{ end -}}
{{ end -}}
<meta name="twitter:image:alt" content="{{ .Title }}">
<meta name="twitter:image" content="{{ .Site.Params.image }}">
<meta name="twitter:image:alt" content="{{ .Site.Params.headerLogoAlt }}">

0 comments on commit 1493571

Please sign in to comment.