bskyweb: iterate on HTML card metadata (#609)

Probably still not perfect, but better.

- don't user avatar image. use banner for profile and post img, or
  nothing
- most twitter metadata fields were redundant; twitter will parse out
  opengraph ("og:"), so don't duplicate those
- add regular HTML description (for google, etc)
- include URI
- actually include text
This commit is contained in:
bnewbold 2023-05-11 08:41:47 -07:00 committed by GitHub
parent 19d6ded631
commit d624b7cf58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 36 deletions

View file

@ -1,24 +1,40 @@
{% extends "base.html" %}
{# TODO: "same as" indication with DID? #}
{# TODO: could work in profileView.DisplayName here, conditionally? #}
{% block head_title %}
{%- if profileView -%}
@{{ profileView.Handle }} on Bluesky
{%- else -%}
Bluesky
{%- endif -%}
{% endblock %}
{% block html_head_extra -%}
{%- if profileView -%}
<meta property="og:type" content="article"/>
<meta name="twitter:card" content="summary"/>
<meta property="og:title" content="{{ profileView.Handle }} - Bluesky"/>
<meta name="twitter:title" content="{{ profileView.Handle}} - Bluesky"/>
<meta property="og:type" content="website">
<meta property="og:site_name" content="Bluesky Social">
{%- if requestURI %}
<meta property="og:url" content="{{ requestURI }}">
{% endif -%}
{%- if profileView.DisplayName %}
<meta property="og:title" content="{{ profileView.DisplayName }} (@{{ profileView.Handle }})">
{% else %}
<meta property="og:title" content="{{ profileView.Handle }}">
{% endif -%}
{%- if profileView.Description %}
<meta property="og:description" content="{{ profileView.Description }}"/>
<meta name="twitter:description" content="{{ profileView.Description }}"/>
<meta name="description" content="{{ profileView.Description }}">
<meta property="og:description" content="{{ profileView.Description }}">
{% endif -%}
{%- if profileView.Avatar %}
<meta property="og:image" content="{{ profileView.Avatar }}"/>
<meta name="twitter:image" content="{{ profileView.Avatar }}"/>
{% endif -%}
<meta name="twitter:label1" content="Author DID">
{%- if profileView.Banner %}
<meta property="og:image" content="{{ profileView.Banner }}">
<meta name="twitter:card" content="summary_large_image">
{%- elif profileView.Avatar -%}
{# Don't use avatar image in cards; usually looks bad #}
<meta name="twitter:card" content="summary">
{% endif %}
<meta name="twitter:label1" content="Account DID">
<meta name="twitter:value1" content="{{ profileView.Did }}">
{%- endif -%}
<meta name="twitter:site" content="@bluesky">
{% endif -%}
{%- endblock %}
{% block noscript_extra -%}