mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 13:14:28 +00:00
Improve template title
This commit is contained in:
parent
b7c421ff80
commit
8ed8a436e5
3 changed files with 8 additions and 4 deletions
8
app.py
8
app.py
|
@ -34,7 +34,7 @@ from flask import request
|
|||
from flask import session
|
||||
from flask import url_for
|
||||
from flask_wtf.csrf import CSRFProtect
|
||||
from html2text import html2text
|
||||
import html2text
|
||||
from itsdangerous import BadSignature
|
||||
from little_boxes import activitypub as ap
|
||||
from little_boxes.activitypub import ActivityType
|
||||
|
@ -123,6 +123,10 @@ else:
|
|||
|
||||
SIG_AUTH = HTTPSigAuth(KEY)
|
||||
|
||||
H2T = html2text.HTML2Text()
|
||||
H2T.ignore_links = True
|
||||
H2T.ignore_images = True
|
||||
|
||||
|
||||
def is_blacklisted(url: str) -> bool:
|
||||
return urlparse(url).netloc in BLACKLIST
|
||||
|
@ -340,7 +344,7 @@ def clean(html):
|
|||
|
||||
@app.template_filter()
|
||||
def html2plaintext(body):
|
||||
return html2text(body)
|
||||
return H2T.handle(body)
|
||||
|
||||
|
||||
@app.template_filter()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>{% block title %}{{ config.NAME }}{% endblock %}'s microblog</title>
|
||||
<title>{% block title %}{{ config.NAME }}'s microblog{% endblock %}</title>
|
||||
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous">
|
||||
<link rel="authorization_endpoint" href="{{ config.ID }}/indieauth">
|
||||
<link rel="token_endpoint" href="{{ config.ID }}/token">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "layout.html" %}
|
||||
{% import 'utils.html' as utils %}
|
||||
{% block title %}{{ config.NAME }}: "{{ note.activity.object.content | html2plaintext | truncate(50) }}"{% endblock %}
|
||||
{% block title %}{{ config.NAME }}: {{ note.activity.object.content | html2plaintext | truncate(50) }}{% endblock %}
|
||||
{% block header %}
|
||||
<meta content="article" property="og:type" />
|
||||
<meta content="{{ note.activity.object.url }}" property="og:url" />
|
||||
|
|
Loading…
Reference in a new issue