feat: configuration for max_summary_length (for og:description)

This commit is contained in:
Ayo Ayco 2025-08-26 02:07:03 +02:00
parent 915c3d3196
commit caabc73295
2 changed files with 5 additions and 3 deletions

View file

@ -5,7 +5,8 @@
"title": "Thoughts",
"description": "Hand-picked public posts from my social feed",
"server": "https://social.ayco.io",
"user_id": "0123456789"
"user_id": "0123456789",
"max_summary_length": 100
}
},
"ATTRIBUTION": {

View file

@ -170,10 +170,11 @@ async def tag(id):
def thread(id):
attribution = get_attribution()
app = get_app_config()
max_length = app.get('max_summary_length', 69) # Configure max summary length
status = fetch_thread(id)
status['summary'] = utils.clean_html(status['content']).strip()
if len(status['summary']) > 69:
status['summary'] = status['summary'][:69] + '...'
if len(status['summary']) > max_length:
status['summary'] = status['summary'][:max_length] + '...'
return render_template('_home.html', threads=[status], app=app, attribution=attribution, render_date=datetime.now())
@threads.route('/api')