From e0974f87ac147543c5aa004942f58055fff7c72b Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 19 Mar 2020 12:01:00 -0700 Subject: [PATCH] Add link to gitub history to the bottom of each article. --- voussoir.net/writing/generate_site.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/voussoir.net/writing/generate_site.py b/voussoir.net/writing/generate_site.py index 899f2f2..39b1cde 100644 --- a/voussoir.net/writing/generate_site.py +++ b/voussoir.net/writing/generate_site.py @@ -19,6 +19,8 @@ ARTICLE_TEMPLATE = ''' [Back to writing](/writing) {body} + +[View this document's history]({github_history}) ''' def write(path, content): @@ -67,9 +69,14 @@ class Article: self.web_path = self.md_file.parent.relative_to(writing_rootdir, simple=True) self.date = git_file_date(self.md_file) + repo = git_repo_for_file(self.md_file) + relative_path = self.md_file.relative_to(repo, simple=True) + github_history = f'https://github.com/voussoir/voussoir.net/commits/master/{relative_path}' + md = vmarkdown.cat_file(self.md_file.absolute_path) md = ARTICLE_TEMPLATE.format( body=md, + github_history=github_history, ) self.soup = vmarkdown.markdown( md,