diff options
author | mjfernez <mjf@mjfer.net> | 2023-11-25 13:04:03 -0500 |
---|---|---|
committer | mjfernez <mjf@mjfer.net> | 2023-11-25 13:04:03 -0500 |
commit | 1cb8cd68cc7e4e244c66a73ea69dcb0461b9b41d (patch) | |
tree | fe55e0bbedcc6a3d92a61a8cb0cba7d236c522b7 | |
parent | f084b6b60b0b19f3a5586ac7508fc8be1ce04624 (diff) | |
download | site-files-1cb8cd68cc7e4e244c66a73ea69dcb0461b9b41d.tar.gz |
Change latest page to show first write date
Previous was to show the last update to the page
-rw-r--r-- | files/latest.html | 22 | ||||
-rw-r--r-- | update_latest.py | 10 |
2 files changed, 17 insertions, 15 deletions
diff --git a/files/latest.html b/files/latest.html index dfc1bab..c524e9a 100644 --- a/files/latest.html +++ b/files/latest.html @@ -1,17 +1,17 @@ <html> <body> -<h3>LATEST CHANGES</h3> +<h3>LATEST POSTS</h3> <ul> - <li><a href=/tutorials/www/quick-intro-html-css.html>tutorials/www/quick-intro-html-css.html</a> - Updated: 2023-11-22</li> - <li><a href=/tutorials/www/how-to-use-the-internet.html>tutorials/www/how-to-use-the-internet.html</a> - Updated: 2023-11-22</li> - <li><a href=/tutorials/vim/how-to-fix-neovim-nerdtree-rendering-issue.html>tutorials/vim/how-to-fix-neovim-nerdtree-rendering-issue.html</a> - Updated: 2023-11-22</li> - <li><a href=/tutorials/pc_gaming/common-gfx-card-installation-woes.html>tutorials/pc_gaming/common-gfx-card-installation-woes.html</a> - Updated: 2023-11-22</li> - <li><a href=/about/whereami.html>about/whereami.html</a> - Updated: 2023-11-22</li> - <li><a href=/about/faq.html>about/faq.html</a> - Updated: 2023-11-22</li> - <li><a href=/files/RESUME.html>files/RESUME.html</a> - Updated: 2023-10-23</li> - <li><a href=/tutorials/splunk/i-found-out-splunk-macros-are-awesome.html>tutorials/splunk/i-found-out-splunk-macros-are-awesome.html</a> - Updated: 2023-10-22</li> - <li><a href=/thoughts/syntax/my-worst-habit.html>thoughts/syntax/my-worst-habit.html</a> - Updated: 2023-09-28</li> - <li><a href=/tutorials/www/how-to-make-this-site.html>tutorials/www/how-to-make-this-site.html</a> - Updated: 2023-09-28</li> + <li><a href=/files/latest.html>files/latest.html</a> - Published: 2023-11-22</li> + <li><a href=/tutorials/splunk/i-found-out-splunk-macros-are-awesome.html>tutorials/splunk/i-found-out-splunk-macros-are-awesome.html</a> - Published: 2023-10-22</li> + <li><a href=/tutorials/pc_gaming/common-gfx-card-installation-woes.html>tutorials/pc_gaming/common-gfx-card-installation-woes.html</a> - Published: 2023-07-14</li> + <li><a href=/thoughts/txt/solution-to-social-media.txt>thoughts/txt/solution-to-social-media.txt</a> - Published: 2023-07-12</li> + <li><a href=/thoughts/txt/midwit.txt>thoughts/txt/midwit.txt</a> - Published: 2023-07-12</li> + <li><a href=/tutorials/www/how-to-use-the-internet.html>tutorials/www/how-to-use-the-internet.html</a> - Published: 2023-07-11</li> + <li><a href=/thoughts/txt/textfiles.com/zf04.txt>thoughts/txt/textfiles.com/zf04.txt</a> - Published: 2022-09-10</li> + <li><a href=/thoughts/txt/textfiles.com/break_into_your_site.txt>thoughts/txt/textfiles.com/break_into_your_site.txt</a> - Published: 2022-09-10</li> + <li><a href=/thoughts/txt/textfiles.com/balls.txt>thoughts/txt/textfiles.com/balls.txt</a> - Published: 2022-09-10</li> + <li><a href=/thoughts/txt/textfiles.com/writers.txt>thoughts/txt/textfiles.com/writers.txt</a> - Published: 2022-09-10</li> </ul> </body> </html> diff --git a/update_latest.py b/update_latest.py index 94bf5a2..26bff62 100644 --- a/update_latest.py +++ b/update_latest.py @@ -5,9 +5,11 @@ from datetime import date from email.utils import parsedate def file_last_modified(path): - git_time = f"git log -n1 --pretty=%aD {path}".split() + git_log = f"git log --pretty=%aD {path}".split() try: - mod_time = subprocess.check_output(git_time) + ps = subprocess.Popen(git_log, stdout=subprocess.PIPE) + mod_time = subprocess.check_output(["tail", "-n1"], + stdin=ps.stdout) except: # File is not in the git log, no biggie, just blank the date return None @@ -30,14 +32,14 @@ for top in dirs: updates[path] = mktime(t) print("<html>") print("<body>") -print("<h3>LATEST CHANGES</h3>") +print("<h3>LATEST POSTS</h3>") print("<ul>") for f, t in sorted(updates.items(), key=lambda x: x[1], reverse=True)[:10]: #print(f, ctime(t), sep="\t") if f != "latest.html": - print(f"\t<li><a href=/{f}>{f.split()[-1]}</a> - Updated: {date.fromtimestamp(t)}</li>") + print(f"\t<li><a href=/{f}>{f.split()[-1]}</a> - Published: {date.fromtimestamp(t)}</li>") print("</ul>") print("</body>") |