Browse Source

add og:image, README typo fix, list all RTL_LANGS

master
The Dod 1 year ago
parent
commit
cff69398a6
3 changed files with 6 additions and 2 deletions
  1. 1
    1
      README.md
  2. 4
    1
      mymastotag.py
  3. 1
    0
      templates/index.html

+ 1
- 1
README.md View File

@@ -7,4 +7,4 @@ of all posts by a matodon `@user@instance account` that contain `#hashtag`
7 7
 For example:
8 8
 
9 9
 * [/en/tooot.im/zvinj/caturday](https://mymastotag.nimrodkerrett.opalstacked.com/en/tooot.im/zvinj/caturday)
10
-* [/en/tooot.im/neo/קפה_ברוח_טובה](https://mymastotag.nimrodkerrett.opalstacked.com/he/tooot.im/neo/%D7%A7%D7%A4%D7%94_%D7%91%D7%A8%D7%95%D7%97_%D7%98%D7%95%D7%91%D7%94)
10
+* [/he/tooot.im/neo/קפה_ברוח_טובה](https://mymastotag.nimrodkerrett.opalstacked.com/he/tooot.im/neo/%D7%A7%D7%A4%D7%94_%D7%91%D7%A8%D7%95%D7%97_%D7%98%D7%95%D7%91%D7%94)

+ 4
- 1
mymastotag.py View File

@@ -3,12 +3,15 @@ import feedparser
3 3
 from flask import Flask, render_template
4 4
 from bs4 import BeautifulSoup
5 5
 
6
+# Source: https://lingohub.com/academy/best-practices/rtl-language-list
7
+RTL_LANGS = ['ar', 'arc', 'dv', 'fa', 'ha', 'he', 'khw', 'ks', 'ku', 'ps', 'ur', 'yi']
8
+
6 9
 application = Flask(__name__)
7 10
 
8 11
 @application.route('/<string:lang>/<string:instance>/<string:user>/<string:tag>')
9 12
 def my_masto_tag(lang, instance, user, tag):
10 13
     lang = lang.lower()
11
-    is_rtl = lang in ['he', 'ar']  # TODO: A less lame to determine rtl
14
+    is_rtl = lang in RTL_LANGS
12 15
     title = f'@{user}@{instance} &mdash; #{tag}'
13 16
     feed = feedparser.parse(f'https://{instance}/@{user}/tagged/{tag}.rss')
14 17
     for e in feed['entries']:

+ 1
- 0
templates/index.html View File

@@ -6,6 +6,7 @@
6 6
     <meta name="viewport" content="width=device-width, initial-scale=1">
7 7
     <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
8 8
     <link rel="stylesheet" href="/static/css/bootstrap{% if is_rtl %}-rtl{% endif %}.min.css">
9
+    <meta property="og:image" content="{{ url_for('static', filename='hashtag.png', _external=True) }}">
9 10
   </head>
10 11
   <body>
11 12
     <div class="container">

Loading…
Cancel
Save