From 4e5bd41953ac00a668a55f2b94d865e0c6f09021 Mon Sep 17 00:00:00 2001 From: Akbar Rahman Date: Tue, 2 Jan 2024 04:02:23 +0000 Subject: [PATCH] generate permalink page --- gronk.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gronk.py b/gronk.py index f3c498f..2dc84c4 100755 --- a/gronk.py +++ b/gronk.py @@ -371,7 +371,19 @@ def process_home_index(args, notes_git_head_sha1=None): args.output_dir.joinpath('index.html').write_text(html) -def generate_tag_browser(output_dir) : +def generate_permalink_page(output_dir): + """ + create the directory and index.html for redirecting permalinks + """ + + dir = output_dir.joinpath('permalink') + dir.mkdir(exist_ok=True) + dir.joinpath('index.html').write_text( + JINJA_TEMPLATE_PERMALINK.render(gronk_commit=GRONK_COMMIT, + data=FILEMAP.get_uuid_map())) + + +def generate_tag_browser(output_dir): """ generate a directory that lets you groub by and browse by any given tag. e.g. tags, authors """ @@ -470,6 +482,7 @@ def main(args): dirs_exist_ok=True) generate_tag_browser(args.output_dir.joinpath('tags')) + generate_permalink_page(args.output_dir) return 0