feat: shorter meta description

This commit is contained in:
Ayo Ayco 2024-04-27 07:45:48 +02:00
parent b9bcdf7264
commit 8383cec7f9
2 changed files with 5 additions and 3 deletions

View file

@ -6,8 +6,8 @@
<title>{{ app.title }}</title> <title>{{ app.title }}</title>
<meta name="theme-color" content="#3054bf"> <meta name="theme-color" content="#3054bf">
{% if threads|length == 1 %} {% if threads|length == 1 %}
<meta name="description" content="{{ threads[0].content_text }}" /> <meta name="description" content="{{ threads[0].summary }}" />
<meta property="og:description" content="{{ threads[0].content_text }}" /> <meta property="og:description" content="{{ threads[0].summary }}" />
{% else %} {% else %}
<meta name="description" content="{{ app.description }}" /> <meta name="description" content="{{ app.description }}" />
<meta property="og:description" content="{{ app.description }}" /> <meta property="og:description" content="{{ app.description }}" />

View file

@ -39,7 +39,9 @@ def home():
def thread(id): def thread(id):
if id in thread_ids: if id in thread_ids:
status = fetch_thread(id) status = fetch_thread(id)
status['content_text'] = clean_html(status['content']).strip() status['summary'] = clean_html(status['content']).strip()
if len(status['summary']) > 69:
status['summary'] = status['summary'][:69] + '...'
return render_template('threads.html', threads=[status], app=app, attribution=attribution) return render_template('threads.html', threads=[status], app=app, attribution=attribution)
else: else:
return '<h1>Not Found</h1><p>¯\_(ツ)_/¯</p><a href="/">go home</a>', 404 return '<h1>Not Found</h1><p>¯\_(ツ)_/¯</p><a href="/">go home</a>', 404