feat: Add static rendering for article pages
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -171,9 +171,9 @@ def static_story(sid):
|
||||
except NotFound:
|
||||
pass
|
||||
|
||||
story = database.get_story(sid)
|
||||
if not story: return abort(404)
|
||||
story = json.loads(story.full_json)
|
||||
story_obj = database.get_story(sid)
|
||||
if not story_obj: return abort(404)
|
||||
story = json.loads(story_obj.full_json)
|
||||
|
||||
score = story['score']
|
||||
num_comments = story['num_comments']
|
||||
@@ -182,7 +182,7 @@ def static_story(sid):
|
||||
score, 's' if score != 1 else '',
|
||||
num_comments, 's' if num_comments != 1 else '',
|
||||
source)
|
||||
url = urlparse(story['url']).hostname or urlparse(story['link']).hostname or ''
|
||||
url = urlparse(story.get('url') or story.get('link') or '').hostname or ''
|
||||
url = url.replace('www.', '')
|
||||
|
||||
return render_template('index.html',
|
||||
@@ -190,6 +190,8 @@ def static_story(sid):
|
||||
url=url,
|
||||
description=description,
|
||||
robots='noindex',
|
||||
story=story,
|
||||
show_comments=request.path.endswith('/c'),
|
||||
)
|
||||
|
||||
http_server = WSGIServer(('', 33842), flask_app)
|
||||
|
||||
Reference in New Issue
Block a user