Update speaker social details
Include Mastodon account on speaker profile and presentation pages. Update Twitter to be X.
This commit is contained in:
parent
10aad67b87
commit
2119ac183a
3 changed files with 32 additions and 4 deletions
|
|
@ -36,11 +36,14 @@
|
|||
<img src="{{ speaker_photo_url }}" alt="{{ speaker }}" class="rounded-circle img-fluid">
|
||||
<p>
|
||||
<strong><a href="{% url "speaker_profile" speaker.pk %}">{{ speaker }}</a></strong><br />
|
||||
{% if speaker.mastodon_username %}
|
||||
<i class="bi-mastodon"></i> <a href="{{ speaker.mastodon_username|mastodon_url }}">{{ speaker.mastodon_username|twitter_handle }}</a>
|
||||
{% endif %}
|
||||
{% if speaker.twitter_username %}
|
||||
<a href="https://twitter.com/{{ speaker.twitter_username }}">{{ speaker.twitter_username|twitter_handle }}</a><br />
|
||||
<i class="bi-twitter-x"></i> <a href="https://x.com/{{ speaker.twitter_username }}">{{ speaker.twitter_username|twitter_handle }}</a><br />
|
||||
{% endif %}
|
||||
{% if speaker.homepage %}
|
||||
<a href="{{ speaker.homepage }}">{{ speaker.homepage }}</a>
|
||||
<i class="bi-globe2"></i> <a href="{{ speaker.homepage }}">{{ speaker.homepage }}</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
<div class="bio">{{ speaker.biography | markdownify }}</div>
|
||||
|
|
|
|||
|
|
@ -9,12 +9,17 @@
|
|||
{% block head_title %}Speaker - {{ speaker.name }}{% endblock %}
|
||||
{% block page_title %}Speaker - {{ speaker.name }}{% endblock %}
|
||||
{% block page_lead %}
|
||||
{% if speaker.mastodon_username %}
|
||||
<i class="bi-mastodon"></i> <a href="{{ speaker.mastodon_username|mastodon_url }}">{{ speaker.mastodon_username|twitter_handle }}</a>
|
||||
{% endif %}
|
||||
{% one_or_more_populated speaker.twitter_username speaker.homepage as has_second %}
|
||||
{% if speaker.mastodon_username and has_second %} | {% endif %}
|
||||
{% if speaker.twitter_username %}
|
||||
<a href="https://twitter.com/{{ speaker.twitter_username }}">{{ speaker.twitter_username|twitter_handle }}</a>
|
||||
<i class="bi-twitter-x"></i> <a href="https://x.com/{{ speaker.twitter_username }}">{{ speaker.twitter_username|twitter_handle }}</a>
|
||||
{% endif %}
|
||||
{% if speaker.twitter_username and speaker.homepage %} | {% endif %}
|
||||
{% if speaker.homepage %}
|
||||
<a href="{{ speaker.homepage }}">{{ speaker.homepage }}</a>
|
||||
<i class="bi-globe2"></i> <a href="{{ speaker.homepage }}">{{ speaker.homepage }}</a>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,3 +71,23 @@ def clean_text(txt):
|
|||
def twitter_handle(txt):
|
||||
# Add @ to twitter handle if not present
|
||||
return txt if txt.startswith('@') else '@{}'.format(txt)
|
||||
|
||||
|
||||
@register.filter
|
||||
def mastodon_url(txt):
|
||||
parts = txt.split('@')
|
||||
if len(parts) == 2:
|
||||
# Assume missing the leading @, so: ACCOUNT_NAME@SERVER_NAME
|
||||
account_name, server_name = parts
|
||||
elif len(parts) == 3:
|
||||
# This is the standard format: @ACCOUNT_NAME@SERVER_NAME
|
||||
_, account_name, server_name = parts
|
||||
else:
|
||||
return ''
|
||||
|
||||
return f'https://{server_name}/@{account_name}'
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def one_or_more_populated(context, *args):
|
||||
return any(args)
|
||||
Loading…
Add table
Reference in a new issue