diff --git a/pg-py/pg.py b/pg-py/pg.py
index 0643a3d..af5b40c 100644
--- a/pg-py/pg.py
+++ b/pg-py/pg.py
@@ -167,7 +167,7 @@ def render_template(template_content, context):
return content
- def generate_html_page(templates, title, content, description="", page_url="", image="", schema_type="article", date="", image_data=None, caption_data=None, post_navigation=""):
+ def generate_html_page(templates, title, content, description="", page_url="", image="", schema_type="article", date="", image_data=None, caption_data=None, post_navigation="", tags=None):
head_template = templates['head']
css_vars = CSS_VAR_PATTERN.findall(head_template)
@@ -197,7 +197,8 @@ def generate_html_page(templates, title, content, description="", page_url="", i
'date': date,
'image_data': image_data or [],
'caption_data': caption_data or [],
- 'nav_items': post_navigation if isinstance(post_navigation, list) else []
+ 'nav_items': post_navigation if isinstance(post_navigation, list) else [],
+ 'tags': tags or []
}
main_content = render_template(content_template, context)
html = f"{templates['header']}\n{main_content}\n{templates['footer']}"
@@ -285,7 +286,11 @@ def process_markdown_file(md_path: Path, templates, output_dir: Path, is_post=Fa
page_url = f"{SITE_URL}/{base_name}/"
schema_type = "article" if is_post else "page"
- full_html = generate_html_page(templates, title, html_content, description, page_url, image, schema_type, date_str, image_data, caption_data, post_navigation="")
+ full_html = generate_html_page(
+ templates, title, html_content, description, page_url, image,
+ schema_type, date_str, image_data, caption_data,
+ post_navigation="", tags=all_tags
+ )
write_html_file(output_path, full_html)
@@ -354,7 +359,7 @@ def generate_index_page(templates, posts, output_dir: Path, page_num=1, is_pagin
title = SITE_TITLE
if tag_name:
- title = f"Posts tagged '{tag_name}' - {SITE_TITLE}"
+ title = f"Posts tagged: {tag_name}"
elif is_pagination:
title = f"Page {page_num} - {SITE_TITLE}"
@@ -390,7 +395,7 @@ def generate_index_page(templates, posts, output_dir: Path, page_num=1, is_pagin
description = "Blog post archive" if is_pagination else SITE_DESC
if tag_name:
- description = f"Posts tagged '{tag_name}'"
+ description = f"Posts tagged {tag_name}"
context = {
'title': title,
@@ -410,7 +415,7 @@ def generate_index_page(templates, posts, output_dir: Path, page_num=1, is_pagin
description = "Blog post archive" if is_pagination else SITE_DESC
if tag_name:
- description = f"Posts tagged '{tag_name}'"
+ description = f"Posts tagged {tag_name}"
page_url = SITE_URL
if is_pagination and page_num > 1:
@@ -550,10 +555,13 @@ def main():
post['post_navigation'] = generate_post_navigation(post, post_pages)
for post in post_pages:
- full_html = generate_html_page(templates, post['title'], post['html_content'],
- post['description'], post['url'], post.get('image', ''),
- "article", post['date'], post.get('image_data', []),
- post.get('caption_data', []), post['post_navigation'])
+ full_html = generate_html_page(
+ templates, post['title'], post['html_content'],
+ post['description'], post['url'], post.get('image', ''),
+ "article", post['date'], post.get('image_data', []),
+ post.get('caption_data', []), post['post_navigation'],
+ tags=post.get('tags', [])
+ )
write_html_file(Path(post['path']), full_html)
index_page = generate_index_page(templates, post_pages, public_dir, page_num=1, is_pagination=False)