diff --git a/server.py b/server.py index f1d6938..457cf25 100644 --- a/server.py +++ b/server.py @@ -141,16 +141,62 @@ def now(): # Get latest now page files = os.listdir('templates/now') # Remove template - files = [file for file in files if file != 'template.html'] + files = [file for file in files if file != 'template.html' and file != 'old.html'] files.sort(reverse=True) date = files[0].strip('.html') # Convert to date date = datetime.datetime.strptime(date, '%y_%m_%d') date = date.strftime('%A, %B %d, %Y') - - return render_template('now/' + files[0], handshake_scripts=handshake_scripts, DATE=date) +@app.route('/now/') +def now_path(path): + global handshake_scripts + # If localhost, don't load handshake + if request.host == "localhost:5000" or request.host == "127.0.0.1:5000" or os.getenv('dev') == "true" or request.host == "test.nathan.woodburn.au": + handshake_scripts = "" + + date = path + date = date.strip('.html') + + try: + # Convert to date + date = datetime.datetime.strptime(date, '%y_%m_%d') + date = date.strftime('%A, %B %d, %Y') + except: + date = "" + + # If file exists, load it + if os.path.isfile('templates/now/' + path): + return render_template('now/' + path, handshake_scripts=handshake_scripts, DATE=date) + if os.path.isfile('templates/now/' + path + '.html'): + return render_template('now/' + path + '.html', handshake_scripts=handshake_scripts, DATE=date) + + return render_template('404.html'), 404 + +@app.route('/now/old') +@app.route('/now/old/') +def now_old(): + global handshake_scripts + # If localhost, don't load handshake + if request.host == "localhost:5000" or request.host == "127.0.0.1:5000" or os.getenv('dev') == "true" or request.host == "test.nathan.woodburn.au": + handshake_scripts = "" + + now_pages = os.listdir('templates/now') + now_pages = [page for page in now_pages if page != 'template.html' and page != 'old.html'] + now_pages.sort(reverse=True) + html = '' + return render_template('now/old.html', handshake_scripts=handshake_scripts,now_pages=html) + @app.route('/') def catch_all(path): diff --git a/templates/now/old.html b/templates/now/old.html new file mode 100644 index 0000000..44943c5 --- /dev/null +++ b/templates/now/old.html @@ -0,0 +1,115 @@ + + + + + + + What's up at the moment | Nathan.Woodburn/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{handshake_scripts | safe}} +
+

Nathan.Woodburn/

+

Now History

+
+
+

Previous Now Pages

+

Check out some of my previous now pages

{{now_pages|safe}} +
+
+
+
+
+
+ +
+
+
+
+ + + + + + \ No newline at end of file diff --git a/templates/sitemap.xml b/templates/sitemap.xml index 9680b93..4ed26a7 100644 --- a/templates/sitemap.xml +++ b/templates/sitemap.xml @@ -6,6 +6,9 @@ https://nathan.woodburn.au/now/24_02_25 + + https://nathan.woodburn.au/now/old + https://nathan.woodburn.au/now/template