Skip to content

Instantly share code, notes, and snippets.

@benjivesterby
Created December 31, 2021 20:01
Show Gist options
  • Save benjivesterby/219f721407289b429d80147d8d5d9eb8 to your computer and use it in GitHub Desktop.
Save benjivesterby/219f721407289b429d80147d8d5d9eb8 to your computer and use it in GitHub Desktop.
meta configs
<!-- Start of Open Graph -->
<meta property="og:title" content="{{ .Title }}">
{{ if .IsPage }}
<meta property="og:type" content="article">
<meta property="article:published_time" content="{{ .Date.Format " 2006-01-02" }}">
{{ else }}
<meta property="og:type" content="website">
{{ end }}
<meta property="og:description" content="{{ .Description }}">
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:site_name" content="{{ .Site.Title }}">
{{ if .Params.thumbnail }}
<meta property="og:image" content="{{ .Site.BaseURL }}{{ .Params.thumbnail }}">
{{ end }}
{{ range .Params.tags }}
<meta property="og:tags" content="{{ . }}">
{{ end }}
<!-- End of Open Graph -->
<!-- Start of Twitter -->
{{ if .Site.Params.twitter_card_whitelisted }}
{{ if .Params.twitter_summary }}
<meta property="twitter:card" content="{{ .Params.twitter_summary }}">
{{ else if .Description }}
<meta property="twitter:card" content="{{ .Description }}">
{{ else }}
<meta property="twitter:card" content="{{ .Title }}">
{{ end }}
{{ end }}
<meta property="twitter:description" content="{{ .Description }}">
<meta property="twitter:title" content="{{ .Title }}">
{{ if .Params.thumbnail }}
<meta property="twitter:image" content="{{ .Site.BaseURL }}{{ .Params.thumbnail }}">
{{ end }}
<!-- End of Twitter -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment