PSLmodels / PSL-Infrastructure

The Policy Simulation Library consists of models and modeling tools that share the transparency standards and interoperability criteria set by the PSL-Infrastructure project
https://www.pslmodels.org
Other
18 stars 17 forks source link

Reducing duplicate code for website #239

Closed Peter-Metz closed 6 months ago

Peter-Metz commented 3 years ago

I'd love to figure out a way to reduce the code that is shared by all pages (e.g. header, navigation bar, footer etc.) without necessarily introducing server-side scripting like Django. Personally, I enjoy how technologically simple the website is, but the duplicate code makes the site a bit harder to maintain. Any ideas?

chusloj commented 3 years ago

What about flask? Not as clunky as Django.

hdoupe commented 3 years ago

Man, I'm really not appreciating all of the hating on Django in this thread...

Kidding. I think we should be able to do this with Jinja2, right? https://github.com/pallets/jinja#in-a-nutshell

image

chusloj commented 3 years ago

I second @hdoupe, I recommended flask because of that exact feature in Jinja2 (which is embedded in flask).

Peter-Metz commented 3 years ago

Thanks guys! I think Jinja will do the trick. I'll look into implementing this

hdoupe commented 2 years ago

This issue has been quiet for a bit, but I just saw the page builder script added by @Peter-Metz: https://github.com/PSLmodels/PSL-Infrastructure/blob/master/Tools/Page-Builder/make_pages.sh

I wonder if we could create a bash script like that one that makes all of the final HTML pages. For reference, I just added a link to the navbar in PR #278, and I had to copy-and-paste the same line of HTML into 13 (!) different pages.

jdebacker commented 6 months ago

Addressed in PR #300