update so that urls are nicer

This commit is contained in:
Shoofle 2024-09-10 12:44:04 -04:00
parent 7d9ae22f6c
commit 84c4fce3ff
2 changed files with 11 additions and 2 deletions

View File

@ -7,3 +7,7 @@ Okay this has been updated towards being statically generated and served by ngin
ic web server you like). I have made a fancy schmancy STATIC SITE GENERATOR in `generate.ignore.py` ic web server you like). I have made a fancy schmancy STATIC SITE GENERATOR in `generate.ignore.py`
, which basically just renders jinja templates for appropriate files! it's pretty self-explanatory, , which basically just renders jinja templates for appropriate files! it's pretty self-explanatory,
use -h to get help on the args, it's a great time. use -h to get help on the args, it's a great time.
shooflenet.service is no longer necessary because this is all run through nginx
nginx needs to be updated to handle -/_ inconsistencies in file names

View File

@ -28,14 +28,19 @@ for path_to_source in source.glob("**/*"):
if ".ignore" in str(rel_path): if ".ignore" in str(rel_path):
continue continue
if ".git" in str(rel_path):
continue
if path_to_source.is_dir(): if path_to_source.is_dir():
pass pass
elif ".article.html" in str(path_to_source): elif ".article.html" in str(path_to_source):
path_to_output = path_to_output.parent / path_to_output.name.replace(".article","") folder_name = path_to_output.parent / path_to_output.name.replace(".article.html","")
os.makedirs(folder_name, exist_ok=True) # make the folder /var/www/shoofle.net/articles/circle_script
path_to_output = folder_name / "index.html"
with open(path_to_output, "w") as output_file: with open(path_to_output, "w") as output_file:
os.makedirs(path_to_output.parent, exist_ok=True)
output_file.write(article_template.render(title="Article", target=str(rel_path))) output_file.write(article_template.render(title="Article", target=str(rel_path)))
elif ".renderme" in str(path_to_source): elif ".renderme" in str(path_to_source):