{% extends "base.html" %}

{% block head_title %}
{%- if postView -%}
  @{{ postView.Author.Handle }} on Bluesky
{%- elif requiresAuth and profileHandle -%}
  @{{ profileHandle }} on Bluesky
{%- else -%}
  Bluesky
{%- endif -%}
{% endblock %}

{% block html_head_extra -%}
{%- if postView -%}
  <meta property="og:type" content="article">
  <meta property="profile:username" content="{{ postView.Author.Handle }}">
  {%- if requestURI %}
  {% if canonicalURL %}
  <meta property="og:url" content="{{ canonicalURL }}">
  <link rel="canonical" href="{{ canonicalURL }}" />
  {% else %}
  <meta property="og:url" content="{{ requestURI }}">
  <link rel="canonical" href="{{ requestURI|canonicalize_url }}" />
  {% endif %}
  {% endif -%}
  {%- if postView.Author.DisplayName %}
  <meta property="og:title" content="{{ postView.Author.DisplayName }} (@{{ postView.Author.Handle }})">
  {% else %}
  <meta property="og:title" content="@{{ postView.Author.Handle }}">
  {% endif -%}
  {%- if postText %}
  <meta name="description" content="{{ postText }}">
  <meta property="og:description" content="{{ postText }}">
  <meta property="twitter:description" content="{{ postText }}">
  {% endif -%}
  {%- if imgThumbUrls %}
  {% for imgThumbUrl in imgThumbUrls %}
  <meta property="og:image" content="{{ imgThumbUrl }}">
  <meta property="twitter:image" content="{{ imgThumbUrl }}">
  {% endfor %}
  <meta name="twitter:card" content="summary_large_image">
  {% else %}
  <meta property="og:image" content="{{ postView.Author.Avatar|avatar_thumbnail }}">
  <meta property="twitter:image" content="{{ postView.Author.Avatar|avatar_thumbnail }}">
  <meta name="twitter:card" content="summary">
  {% endif %}
  {%- if videoUrl %}
  <meta property="og:video" content="{{ videoUrl }}">
  <meta property="og:video:type" content="{{ videoType }}">
  {%- if videoWidth %}
  <meta property="og:video:width" content="{{ videoWidth }}">
  <meta property="og:video:height" content="{{ videoHeight }}">
  {% endif -%}
  {% endif -%}
  <meta name="twitter:label1" content="Posted At">
  <meta name="twitter:value1" content="{{ postView.IndexedAt }}">
  {%- if postView.LikeCount %}
  <meta name="twitter:label2" content="Likes">
  <meta name="twitter:value2" content="{{ postView.LikeCount }}">
  {% endif -%}
  {%- if postView.ReplyCount %}
  <meta name="twitter:label3" content="Replies">
  <meta name="twitter:value3" content="{{ postView.ReplyCount }}">
  {% endif -%}
  {%- if postView.RepostCount %}
  <meta name="twitter:label4" content="Reposts">
  <meta name="twitter:value4" content="{{ postView.RepostCount }}">
  {% endif -%}
  <meta property="article:published_time" content="{{ postView.IndexedAt }}">
  <link rel="alternate" type="application/json+oembed" href="https://embed.bsky.app/oembed?format=json&url={{ postView.Uri | urlencode }}" />
  <link rel="alternate" href="{{ postView.Uri }}" />
  {%- if postJSONLD %}
  <script type="application/ld+json">{{ postJSONLD|safe }}</script>
  {% endif -%}
{%- elif requiresAuth and profileHandle -%}
  <meta property="og:type" content="article">
  <meta property="profile:username" content="{{ profileHandle }}">
  {%- if requestURI %}
  {% if canonicalURL %}
  <meta property="og:url" content="{{ canonicalURL }}">
  <link rel="canonical" href="{{ canonicalURL }}" />
  {% else %}
  <meta property="og:url" content="{{ requestURI }}">
  <link rel="canonical" href="{{ requestURI|canonicalize_url }}" />
  {% endif %}
  {% endif -%}
  {%- if profileDisplayName %}
  <meta property="og:title" content="{{ profileDisplayName }} (@{{ profileHandle }})">
  {% else %}
  <meta property="og:title" content="@{{ profileHandle }}">
  {% endif -%}
  <meta name="description" content="This author has chosen to make their posts visible only to people who are signed in.">
  <meta property="og:description" content="This author has chosen to make their posts visible only to people who are signed in.">
  <meta property="twitter:description" content="This author has chosen to make their posts visible only to people who are signed in.">
  <meta name="twitter:card" content="summary">
{% endif -%}
{%- endblock %}

{% block noscript_extra -%}
{%- if postView -%}
<div id="bsky_post_summary">
  <h3>Post</h3>
  <p id="bsky_display_name">{{ postView.Author.DisplayName }}</p>
  <p id="bsky_handle">{{ postView.Author.Handle }}</p>
  <p id="bsky_did">{{ postView.Author.Did }}</p>
  <p id="bsky_post_text">{{ postText }}</p>
  <p id="bsky_post_indexedat">{{ postView.IndexedAt }}</p>
</div>
{%- elif requiresAuth and profileHandle -%}
<div id="bsky_post_summary">
  <h3>Post</h3>
  <p id="bsky_handle">{{ profileHandle }}</p>
      <p id="bsky_post_text">This author has chosen to make their posts visible only to people who are signed in.</p>
</div>
{% endif -%}
{%- endblock %}
