base.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {{- $title := partialCached "data/title" . .RelPermalink -}}
  2. {{- $description := partialCached "data/description" . .RelPermalink -}}
  3. <meta property='og:title' content='{{ $title }}'>
  4. <meta property='og:description' content='{{ $description }}'>
  5. <meta property='og:url' content='{{ .Permalink }}'>
  6. <meta property='og:site_name' content='{{ .Site.Title }}'>
  7. <meta property='og:type' content='
  8. {{- if .IsPage -}}
  9. article
  10. {{- else -}}
  11. website
  12. {{- end -}}
  13. '>
  14. {{- with .Params.locale -}}
  15. <meta property='og:locale' content='{{ . }}'>
  16. {{- end -}}
  17. {{- if .IsPage -}}
  18. <meta property='article:section' content='{{ .Section | title }}' />
  19. {{- range .Params.tags -}}
  20. <meta property='article:tag' content='{{ . }}' />
  21. {{- end -}}
  22. {{- end -}}
  23. {{- if .IsPage -}}
  24. {{- if not .Date.IsZero -}}
  25. <meta property='article:published_time' content='{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}'/>
  26. {{- end -}}
  27. {{- if not .Lastmod.IsZero -}}
  28. <meta property='article:modified_time' content='{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}'/>
  29. {{- end -}}
  30. {{- else -}}
  31. {{- if not .Site.LastChange.IsZero -}}
  32. <meta property='og:updated_time' content='{{ .Site.LastChange.Format " 2006-01-02T15:04:05-07:00 " | safeHTML }}'/>
  33. {{- end -}}
  34. {{- end -}}
  35. {{ $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" }}
  36. {{- if $image.exists -}}
  37. <meta property='og:image' content='{{ absURL $image.permalink }}' />
  38. {{- end -}}