improve profile card
This commit is contained in:
@@ -394,6 +394,9 @@ func (srv *Server) Shutdown() error {
|
||||
func (srv *Server) NewTemplateContext() pongo2.Context {
|
||||
return pongo2.Context{
|
||||
"staticCDNHost": srv.cfg.staticCDNHost,
|
||||
"favicon": fmt.Sprintf("%s/static/favicon.png", "https://bsky.app"),
|
||||
// specify the default image for social cards
|
||||
"defaultBannerImage": fmt.Sprintf("%s/static/social-card-default.png", srv.cfg.staticCDNHost),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,13 +602,16 @@ func (srv *Server) WebProfile(c echo.Context) error {
|
||||
unauthedViewingOkay = false
|
||||
}
|
||||
}
|
||||
if !unauthedViewingOkay {
|
||||
return c.Render(http.StatusOK, "profile.html", data)
|
||||
}
|
||||
|
||||
req := c.Request()
|
||||
data["profileView"] = pv
|
||||
data["requestURI"] = fmt.Sprintf("https://%s%s", req.Host, req.URL.Path)
|
||||
data["requestHost"] = req.Host
|
||||
|
||||
if !unauthedViewingOkay {
|
||||
data["requiresAuth"] = true
|
||||
}
|
||||
|
||||
return c.Render(http.StatusOK, "profile.html", data)
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
<meta name="application-name" content="Bluesky">
|
||||
<meta name="generator" content="bskyweb">
|
||||
<meta property="og:site_name" content="Bluesky Social">
|
||||
<meta property="og:logo" content="{{ favicon }}">
|
||||
<meta name="twitter:site" content="@bluesky" />
|
||||
<link type="application/activity+json" href="" />
|
||||
|
||||
|
||||
@@ -9,36 +9,48 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block html_head_extra -%}
|
||||
{%- if profileView -%}
|
||||
<meta property="og:site_name" content="Bluesky Social">
|
||||
<meta property="og:type" content="profile">
|
||||
<meta property="profile:username" content="{{ profileView.Handle }}">
|
||||
{%- if requestURI %}
|
||||
{%- if requestURI %}
|
||||
<meta property="og:url" content="{{ requestURI }}">
|
||||
<link rel="canonical" href="{{ requestURI|canonicalize_url }}" />
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
|
||||
{%- if profileView -%}
|
||||
<meta property="profile:username" content="{{ profileView.Handle }}">
|
||||
{%- 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 name="description" content="{{ profileView.Description }}">
|
||||
<meta property="og:description" content="{{ profileView.Description }}">
|
||||
{% endif -%}
|
||||
{%- 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 %}
|
||||
|
||||
<link rel="alternate" href="at://{{ profileView.Did }}/app.bsky.actor.profile/self" />
|
||||
|
||||
<meta name="twitter:label1" content="Account DID">
|
||||
<meta name="twitter:value1" content="{{ profileView.Did }}">
|
||||
|
||||
{%- if requestHost %}
|
||||
<link rel="alternate" type="application/rss+xml" href="https://{{ requestHost }}/profile/{{ profileView.Did }}/rss">
|
||||
{% endif %}
|
||||
<link rel="alternate" href="at://{{ profileView.Did }}/app.bsky.actor.profile/self" />
|
||||
|
||||
{# Only show details if auth isn't required #}
|
||||
{% if not requiresAuth %}
|
||||
{%- if profileView.Description %}
|
||||
<meta name="description" content="{{ profileView.Description }}">
|
||||
<meta property="og:description" content="{{ profileView.Description }}">
|
||||
{% endif -%}
|
||||
{%- 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 %}
|
||||
{% else %}
|
||||
<meta name="description" content="This profile requires authentication to view.">
|
||||
<meta property="og:description" content="This profile requires authentication to view.">
|
||||
<meta property="twitter:description" content="This profile requires authentication to view.">
|
||||
{% endif %}
|
||||
{% endif -%}
|
||||
{%- endblock %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user