github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/opengraph.html (about)

     1  {{- /* based on Hugo 0.125.0 _internal/opengraph.html but with modified title */}}
     2  {{- $format := partial "get-format.hugo" . }}
     3  {{- $outputFormat := partial "output-format.hugo" (dict "page" . "format" $format) }}
     4  {{- $basename := "index" }}
     5  {{- if eq $outputFormat "searchpage" }}
     6    {{- $basename = partial "BaseName.hugo" $format.RelPermalink }}
     7  {{- end }}
     8      <meta property="og:url" content="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true "basename" $basename) }}">
     9  
    10  {{- with or site.Title site.Params.title | plainify }}
    11      <meta property="og:site_name" content="{{ . }}">
    12  {{- end }}
    13      <meta property="og:title" content="{{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) | plainify }}">
    14  
    15  {{- with or .Description .Summary site.Params.description | plainify }}
    16      <meta property="og:description" content="{{ . }}">
    17  {{- end }}
    18  
    19  {{- with or .Params.locale site.Language.LanguageCode site.Language.Lang }}
    20      <meta property="og:locale" content="{{ . }}">
    21  {{- end }}
    22  
    23  {{- if .IsPage }}
    24      <meta property="og:type" content="article">
    25    {{- with .FirstSection }}
    26      <meta property="article:section" content="{{ partial "pageHelper/title.hugo" (dict "page" . "fullyQualified" true "reverse" true "format" $format "outputFormat" $outputFormat) | plainify }}">
    27    {{- end }}
    28    {{- $iso8601 := "2006-01-02T15:04:05-07:00" }}
    29    {{- with .PublishDate }}
    30      <meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
    31    {{- end }}
    32    {{- with .Lastmod }}
    33      <meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
    34    {{- end }}
    35    {{- range .GetTerms "tags" | first 6 }}
    36      <meta property="article:tag" content="{{ .Page.Title | plainify }}">
    37    {{- end }}
    38  {{- else }}
    39      <meta property="og:type" content="website">
    40  {{- end }}
    41  
    42  {{- with partial "_funcs/get-page-images" . }}
    43    {{- range . | first 6 }}
    44      <meta property="og:image" content="{{ .Permalink }}">
    45    {{- end }}
    46  {{- end }}
    47  
    48  {{- with .Params.audio }}
    49    {{- range . | first 6  }}
    50      <meta property="og:audio" content="{{ . | absURL }}">
    51    {{- end }}
    52  {{- end }}
    53  
    54  {{- with .Params.videos }}
    55    {{- range . | first 6 }}
    56      <meta property="og:video" content="{{ . | absURL }}">
    57    {{- end }}
    58  {{- end }}
    59  
    60  {{- range .GetTerms "series" }}
    61    {{- range .Pages | first 7 }}
    62      {{- if ne $ . }}
    63      <meta property="og:see_also" content="{{ .Permalink }}">
    64      {{- end }}
    65    {{- end }}
    66  {{- end }}
    67  
    68  {{- $facebookApp := "" }}
    69  {{- with site.Params.social }}
    70    {{- if reflect.IsMap . }}
    71      {{- with .facebook_app_id }}
    72        {{- $facebookApp = . }}
    73      {{- end }}
    74    {{- end }}
    75  {{- end }}
    76  
    77  {{- $facebookAdmin := "" }}
    78  {{- with site.Params.social.facebook_admin }}
    79    {{- $facebookAdmin = . }}
    80  {{- else }}
    81    {{- with site.Social.facebook_admin }}
    82      {{- $facebookAdmin = . }}
    83      {{- $hugoVersion := "0.120.0" }}
    84      {{- if ge hugo.Version $hugoVersion }}
    85        {{- warnf "The social key in site configuration is deprecated. Use params.social.facebook_admin instead." }}
    86      {{- end }}
    87    {{- end }}
    88  {{- end }}
    89  
    90  {{- with $facebookApp }}
    91      <meta property="fb:app_id" content="{{ . }}">
    92  {{- else }}
    93    {{- with $facebookAdmin }}
    94      <meta property="fb:admins" content="{{ . }}">
    95    {{- end }}
    96  {{- end }}