fix: Update cleanSite hook to clean now page html files
All checks were successful
Build Docker / BuildImage (push) Successful in 1m9s
All checks were successful
Build Docker / BuildImage (push) Successful in 1m9s
This commit is contained in:
parent
f9b30a3fe6
commit
7896f71534
29
cleanSite.py
29
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)
|
||||
with open(path, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
|
||||
for file in os.listdir('templates'):
|
||||
cleanSite('templates/' + file)
|
3
now.py
3
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
|
||||
|
||||
|
@ -650,7 +650,6 @@ def now_path(path):
|
||||
):
|
||||
handshake_scripts = ""
|
||||
|
||||
|
||||
return now.render_now_page(path,handshake_scripts)
|
||||
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_02_18.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_02_18.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_02_18">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_02_18">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_02_25.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_02_25.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_02_25">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_02_25">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_04_19.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_04_19.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_04_19">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_04_19">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_05_20.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_05_20.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_05_20">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_05_20">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_05_28.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_05_28.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_05_28">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_05_28">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_06_06.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_06_06.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_06_06">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_06_06">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_06_17.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_06_17.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_06_17">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_06_17">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_06_24.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_06_24.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_06_24">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_06_24">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_07_15.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_07_15.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_07_15">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_07_15">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_08_05.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_08_05.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_08_05">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_08_05">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_09_07.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_09_07.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_09_07">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_09_07">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_09_27.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_09_27.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_09_27">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_09_27">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_10_07.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_10_07.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_10_07">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_10_07">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_10_15.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_10_15.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_10_15">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_10_15">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_10_22.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_10_22.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_10_22">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_10_22">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_12_19.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_12_19.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/24_12_19">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/24_12_19">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/25_01_01.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/25_01_01.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/25_01_01">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/25_01_01">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
@ -66,7 +66,7 @@ Find out what I've been up to in the last week">
|
||||
<section style="margin-bottom: 50px;">
|
||||
<div style="max-width: 700px;margin: auto;">
|
||||
<h1 style="margin-bottom: 0px;">Other project updates</h1>
|
||||
<p>I've took over managing and hosting <a href="https://handypedia.org" target="_blank">Handypedia</a> (a community run wiki for Handshake) in February.<br>I had a few updates for HNS Login throughout the year to add HNS.ID domains.<br><br></p>
|
||||
<p>I took over managing and hosting <a href="https://handypedia.org" target="_blank">Handypedia</a> (a community run wiki for Handshake) in February.<br>I had a few updates for HNS Login throughout the year to add HNS.ID domains.<br><br></p>
|
||||
</div>
|
||||
</section>
|
||||
<section style="margin-bottom: 50px;">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/old.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/old.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/old">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/old">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
|
||||
<title>What's up at the moment | Nathan.Woodburn/</title>
|
||||
<meta name="theme-color" content="#000000">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/template.html">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/template.html">
|
||||
<link rel="canonical" href="https://nathan.woodburn.au/now/template">
|
||||
<meta property="og:url" content="https://nathan.woodburn.au/now/template">
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:image" content="https://nathan.woodburn.au/assets/img/profile.jpg">
|
||||
<meta property="og:type" content="website">
|
||||
|
Loading…
Reference in New Issue
Block a user