Skip to content

Instantly share code, notes, and snippets.

@fauzanmy
Last active September 9, 2022 09:17
Show Gist options
  • Save fauzanmy/cf203db40886f41e151138c77621c04d to your computer and use it in GitHub Desktop.
Save fauzanmy/cf203db40886f41e151138c77621c04d to your computer and use it in GitHub Desktop.
Hugo create meta opengraph,
<!--Meta:OG-->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@{{.Site.Params.twitter}}" />
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:title" content="{{ .Title }}" />
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Params.description }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
<meta property="og:image" content="{{ if .IsPage }}{{ with .Params.images }}{{ . | absURL }}{{ end }}{{ else }}{{ with .Site.Params.cover }}{{ . | absURL }}{{ end }}{{ end }}" />
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment