From 7b8df1ed7fac6f6f25dec5732df8740c22eb4e8f Mon Sep 17 00:00:00 2001
From: MattTheTekie <94870997+MattTheTekie@users.noreply.github.com>
Date: Fri, 6 Oct 2023 08:51:01 -0400
Subject: [PATCH] Update test.py
---
test.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/test.py b/test.py
index 78abaa5..28ee24d 100644
--- a/test.py
+++ b/test.py
@@ -51,7 +51,7 @@ def blog(filename):
@app.route('/blogquest')
def blogquest():
- blog_links = []
+ blog_data = []
# Iterate through files in the "blogs" folder
for filename in os.listdir(blog_folder):
@@ -69,9 +69,14 @@ def blogquest():
if title_start != -1 and title_end != -1 and author_start != -1 and author_end != -1:
blog_title = html_content[title_start:title_end]
author_name = html_content[author_start:author_end]
- blog_links.append(f'{blog_title} by {author_name}')
+ blog_data.append({
+ 'title': blog_title,
+ 'author': author_name,
+ 'url': f"/blog/{filename}"
+ })
+
+ return render_template('blogquest.html', blogs=blog_data)
- return "
".join(blog_links)
if __name__ == '__main__':
app.run(debug=True, port=8162)