blog

Log | Files | Refs

opengraph.html (2628B)


      1 <meta property="og:url" content="{{ .Permalink }}">
      2 
      3 {{- with or site.Title site.Params.title | plainify }}
      4   <meta property="og:site_name" content="{{ . }}">
      5 {{- end }}
      6 
      7 {{- with or .Title site.Title site.Params.title | plainify }}
      8   <meta property="og:title" content="{{ . }}">
      9 {{- end }}
     10 
     11 {{- with or .Description .Summary site.Params.description | plainify | htmlUnescape }}
     12   <meta property="og:description" content="{{ trim . "\n\r\t " }}">
     13 {{- end }}
     14 
     15 {{- with or .Params.locale site.Language.LanguageCode }}
     16   <meta property="og:locale" content="{{ replace . `-` `_` }}">
     17 {{- end }}
     18 
     19 {{- if .IsPage }}
     20   <meta property="og:type" content="article">
     21   {{- with .Section }}
     22     <meta property="article:section" content="{{ . }}">
     23   {{- end }}
     24   {{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
     25   {{- with .PublishDate }}
     26     <meta property="article:published_time" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
     27   {{- end }}
     28   {{- with .Lastmod }}
     29     <meta property="article:modified_time" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
     30   {{- end }}
     31   {{- range .GetTerms "tags" | first 6 }}
     32     <meta property="article:tag" content="{{ .Page.Title | plainify }}">
     33   {{- end }}
     34 {{- else }}
     35   <meta property="og:type" content="website">
     36 {{- end }}
     37 
     38 {{- if .Params.cover.image -}}
     39   {{- if (ne .Params.cover.relative true) }}
     40     <meta property="og:image" content="{{ .Params.cover.image | absURL }}">
     41   {{- else}}
     42     <meta property="og:image" content="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}">
     43   {{- end}}
     44 {{- else }}
     45   {{- with partial "_funcs/get-page-images" . }}
     46     {{- range . | first 6 }}
     47       <meta property="og:image" content="{{ .Permalink }}">
     48     {{- end }}
     49   {{- end }}
     50 {{- end }}
     51 
     52 {{- with .Params.audio }}
     53   {{- range . | first 6  }}
     54     <meta property="og:audio" content="{{ . | absURL }}">
     55   {{- end }}
     56 {{- end }}
     57 
     58 {{- with .Params.videos }}
     59   {{- range . | first 6 }}
     60     <meta property="og:video" content="{{ . | absURL }}">
     61   {{- end }}
     62 {{- end }}
     63 
     64 {{- range .GetTerms "series" }}
     65   {{- range .Pages | first 7 }}
     66     {{- if ne $ . }}
     67       <meta property="og:see_also" content="{{ .Permalink }}">
     68     {{- end }}
     69   {{- end }}
     70 {{- end }}
     71 
     72 {{- with site.Params.social }}
     73   {{- if reflect.IsMap . }}
     74     {{- with .facebook_app_id }}
     75       <meta property="fb:app_id" content="{{ . }}">
     76     {{- else }}
     77       {{- with .facebook_admin }}
     78         <meta property="fb:admins" content="{{ . }}">
     79       {{- end }}
     80     {{- end }}
     81   {{- end }}
     82 {{- end }}
     83 
     84 {{- with (.Param "social.fediverse_creator") }}
     85   <meta name="fediverse:creator" content="{{ . }}">
     86 {{- end }}