feat: show year range of copyright
This commit is contained in:
parent
5767e2738d
commit
5cd45f7cf2
2 changed files with 21 additions and 2 deletions
|
@ -237,7 +237,15 @@
|
|||
</ul>
|
||||
</main>
|
||||
<footer>
|
||||
© {{ attribution.year }} {{ attribution.owner }}
|
||||
<p>
|
||||
Copyright ©
|
||||
{% if attribution.current_year %}
|
||||
{{ attribution.year }}-{{ attribution.current_year }}
|
||||
{%else%}
|
||||
{{ attribution.year }}
|
||||
{% endif %}
|
||||
{{ attribution.owner }}
|
||||
</p>
|
||||
<p>Powered by <a href="https://ayco.io/sh/threads">/threads</a></p>
|
||||
</footer>
|
||||
</body>
|
||||
|
|
13
threads.py
13
threads.py
|
@ -1,5 +1,6 @@
|
|||
from flask import Blueprint, render_template
|
||||
import requests
|
||||
import datetime
|
||||
|
||||
threads = Blueprint('threads', __name__, template_folder='template')
|
||||
|
||||
|
@ -12,10 +13,20 @@ app = {
|
|||
}
|
||||
attribution = {
|
||||
"owner": "Ayo Ayco",
|
||||
"year": "2024"
|
||||
"year": "2022" # earliest year in featured posts
|
||||
}
|
||||
###########################################################
|
||||
|
||||
@threads.before_request
|
||||
def middleware():
|
||||
# check current year and put ange as attribution
|
||||
currentDateTime = datetime.datetime.now()
|
||||
date = currentDateTime.date()
|
||||
year = date.strftime("%Y")
|
||||
if year != attribution['year']:
|
||||
attribution['current_year'] = year
|
||||
|
||||
|
||||
@threads.route('/')
|
||||
def home():
|
||||
statuses = fetch_statuses()
|
||||
|
|
Loading…
Reference in a new issue