Files
njump/templates/opengraph.html

40 lines
1.6 KiB
HTML

{{ if not (eq "" .SingleTitle)}}
<!-- we only display this on twitter as a single title -->
<meta name="twitter:title" content="{{.SingleTitle}}" />
{{ else }}
<!-- these are not shown by twitter at all, so let's not even give them -->
<meta property="og:site_name" content="{{.Superscript}}" />
<meta property="og:title" content="{{.Subscript}}" />
{{ end }}
<!-- this is used for when we want to take over the entire screen on twitter,
mostly for the big "text-to-image" images -->
{{ if not (eq "" .BigImage) }}
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@nostrprotocol" />
<meta property="og:image" content="{{.BigImage}}" />
<meta name="twitter:image" content="{{.BigImage}}" />
{{ else }}
<!-- otherwise we tell twitter to display it as a normal text-based embed.
these distinctions don't seem to make any difference in other platforms,
maybe telegram -->
<meta name="twitter:card" content="summary" />
{{ if not (eq "" .Image) }}
<meta property="og:image" content="{{.Image}}" />
<meta name="twitter:image" content="{{.ProxiedImage}}" />
{{ end }}
<!---->
{{ if not (eq "" .Video) }}
<meta property="og:video" content="{{.Video}}" />
<meta property="og:video:secure_url" content="{{.Video}}" />
<meta property="og:video:type" content="video/{{.VideoType}}" />
{{ end }}
<!-- end the BigImage /if above -->
{{ end }}
<!-- now just display the short text if we have any (which we always should) -->
{{ if not (eq "" .Text) }}
<meta property="og:description" content="{{.Text}}" />
<meta name="twitter:description" content="{{.Text}}" />
{{ end }}