diff --git a/cleanSite.py b/cleanSite.py index e33a6ff..ae75423 100644 --- a/cleanSite.py +++ b/cleanSite.py @@ -1,29 +1,36 @@ import os -# Read all files in the templates directory -for file in os.listdir('templates'): +def cleanSite(path:str): # Check if the file is sitemap.xml - if file == 'sitemap.xml': + if path.endswith('sitemap.xml'): # Open the file - with open('templates/sitemap.xml', 'r') as f: + with open(path, 'r') as f: # Read the content content = f.read() # Replace all .html with empty string content = content.replace('.html', '') # Write the content back to the file - with open('templates/sitemap.xml', 'w') as f: + with open(path, 'w') as f: f.write(content) # Skip the file - continue + return # If the file is not an html file, skip it - if not file.endswith('.html'): - continue + if not path.endswith('.html'): + if os.path.isdir(path): + for file in os.listdir(path): + cleanSite(path + '/' + file) + + return # Open the file - with open('templates/' + file, 'r') as f: + with open(path, 'r') as f: # Read and remove all .html content = f.read().replace('.html"', '"') # Write the cleaned content back to the file - with open('templates/' + file, 'w') as f: - f.write(content) \ No newline at end of file + with open(path, 'w') as f: + f.write(content) + + +for file in os.listdir('templates'): + cleanSite('templates/' + file) \ No newline at end of file diff --git a/now.py b/now.py index dc1e0b7..17befb4 100644 --- a/now.py +++ b/now.py @@ -29,6 +29,9 @@ def render_now_page(date,handshake_scripts=None): # If the date is not available, render the latest page if date is None: return render_latest_now(handshake_scripts=handshake_scripts) + # Remove .html + date = date.removesuffix(".html") + if not date in list_now_dates(): return render_template("404.html"), 404 diff --git a/server.py b/server.py index ed8fddb..4619996 100644 --- a/server.py +++ b/server.py @@ -650,7 +650,6 @@ def now_path(path): ): handshake_scripts = "" - return now.render_now_page(path,handshake_scripts) diff --git a/templates/now/24_02_18.html b/templates/now/24_02_18.html index e7ee3d3..65ae3fd 100644 --- a/templates/now/24_02_18.html +++ b/templates/now/24_02_18.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_02_25.html b/templates/now/24_02_25.html index 04ff74b..426e044 100644 --- a/templates/now/24_02_25.html +++ b/templates/now/24_02_25.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_04_19.html b/templates/now/24_04_19.html index 98d8e41..0261f9b 100644 --- a/templates/now/24_04_19.html +++ b/templates/now/24_04_19.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_05_20.html b/templates/now/24_05_20.html index d463b8b..4a81a39 100644 --- a/templates/now/24_05_20.html +++ b/templates/now/24_05_20.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_05_28.html b/templates/now/24_05_28.html index d158903..400aaa4 100644 --- a/templates/now/24_05_28.html +++ b/templates/now/24_05_28.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_06_06.html b/templates/now/24_06_06.html index 69172b9..bf70ac7 100644 --- a/templates/now/24_06_06.html +++ b/templates/now/24_06_06.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_06_17.html b/templates/now/24_06_17.html index f8a16f6..d34af61 100644 --- a/templates/now/24_06_17.html +++ b/templates/now/24_06_17.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_06_24.html b/templates/now/24_06_24.html index 38fe695..4e0d4f3 100644 --- a/templates/now/24_06_24.html +++ b/templates/now/24_06_24.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_07_15.html b/templates/now/24_07_15.html index 69d273f..af1003e 100644 --- a/templates/now/24_07_15.html +++ b/templates/now/24_07_15.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_08_05.html b/templates/now/24_08_05.html index 68ec9aa..0513091 100644 --- a/templates/now/24_08_05.html +++ b/templates/now/24_08_05.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_09_07.html b/templates/now/24_09_07.html index d236ebd..895ddf7 100644 --- a/templates/now/24_09_07.html +++ b/templates/now/24_09_07.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_09_27.html b/templates/now/24_09_27.html index 625b4a0..a7d9447 100644 --- a/templates/now/24_09_27.html +++ b/templates/now/24_09_27.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_10_07.html b/templates/now/24_10_07.html index 3e6f5f4..932bd63 100644 --- a/templates/now/24_10_07.html +++ b/templates/now/24_10_07.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_10_15.html b/templates/now/24_10_15.html index d4d7147..b6b7cc5 100644 --- a/templates/now/24_10_15.html +++ b/templates/now/24_10_15.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_10_22.html b/templates/now/24_10_22.html index 38202ed..7347aea 100644 --- a/templates/now/24_10_22.html +++ b/templates/now/24_10_22.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/24_12_19.html b/templates/now/24_12_19.html index 7e7f2a0..22cfeca 100644 --- a/templates/now/24_12_19.html +++ b/templates/now/24_12_19.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/25_01_01.html b/templates/now/25_01_01.html index 1eeef4d..54eb257 100644 --- a/templates/now/25_01_01.html +++ b/templates/now/25_01_01.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + @@ -66,7 +66,7 @@ Find out what I've been up to in the last week">

Other project updates

-

I've took over managing and hosting Handypedia (a community run wiki for Handshake) in February.
I had a few updates for HNS Login throughout the year to add HNS.ID domains.

+

I took over managing and hosting Handypedia (a community run wiki for Handshake) in February.
I had a few updates for HNS Login throughout the year to add HNS.ID domains.

diff --git a/templates/now/old.html b/templates/now/old.html index 228844c..1a273c8 100644 --- a/templates/now/old.html +++ b/templates/now/old.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + + diff --git a/templates/now/template.html b/templates/now/template.html index fbf445d..bb9c3ae 100644 --- a/templates/now/template.html +++ b/templates/now/template.html @@ -6,8 +6,8 @@ What's up at the moment | Nathan.Woodburn/ - - + +