From 333497f9baff20a1b5cafefcf919787228f82bfc Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 26 May 2025 15:00:42 -0400 Subject: [PATCH] Add book commentary data to book page template Generate and display introduction, historical context, themes, and key passages for each book using the generate_book_commentary function. Includes enhanced typography with EB Garamond and improved styling. --- kjvstudy_org/server.py | 12 +++- kjvstudy_org/templates/book.html | 98 ++++++++++++++++++++++++++------ 2 files changed, 93 insertions(+), 17 deletions(-) diff --git a/kjvstudy_org/server.py b/kjvstudy_org/server.py index 7fc3700..2bc1dd4 100644 --- a/kjvstudy_org/server.py +++ b/kjvstudy_org/server.py @@ -117,9 +117,19 @@ def read_book(request: Request, book: str): status_code=404, detail=f"The book '{book}' was not found. Please check the spelling or browse all available books." ) + + # Generate commentary data for the book page + commentary_data = generate_book_commentary(book, chapters) + return templates.TemplateResponse( "book.html", - {"request": request, "book": book, "chapters": chapters, "books": books}, + { + "request": request, + "book": book, + "chapters": chapters, + "books": books, + **commentary_data + }, ) diff --git a/kjvstudy_org/templates/book.html b/kjvstudy_org/templates/book.html index 65cb257..498cab5 100644 --- a/kjvstudy_org/templates/book.html +++ b/kjvstudy_org/templates/book.html @@ -4,6 +4,44 @@ {% block description %}Read {{ book }} from the Authorized King James Version (KJV) Bible. Browse all chapters of {{ book }} with enhanced readability and navigation tools.{% endblock %} {% block keywords %}{{ book }}, {{ book }} KJV, {{ book }} King James Version, Authorized King James Version, KJV Bible, {{ book }} chapters{% endblock %} +{% block head %} + + + + +{% endblock %} + {% block schema_type %}Book{% endblock %} {% block structured_data %}, "name": "{{ book }} - Authorized King James Version", @@ -57,22 +95,50 @@ {% endfor %} -
-

- 📚 Book Commentary -

-

- Explore our comprehensive commentary on {{ book }} with historical context, theological insights, - and verse-by-verse analysis. Includes chapter summaries and cross-references to other biblical books. -

- - Read {{ book }} Commentary - -

- "Study to shew thyself approved unto God, a workman that needeth not to be ashamed, rightly dividing the word of truth." -
- 2 Timothy 2:15 -

+
+
+

+ 📚 Commentary on {{ book }} +

+ +
+

Introduction

+ {{ introduction|safe }} +
+ +
+

Historical Context

+ {{ historical_context|safe }} +
+ +
+

Major Themes

+ {{ themes|safe }} +
+ +
+

Key Passages

+
+ {% for highlight in highlights %} +
+

{{ highlight.reference }}

+

{{ highlight.description }}

+
+ {% endfor %} +
+
+ +
+ + Read Complete {{ book }} Commentary + +

+ "Study to shew thyself approved unto God, a workman that needeth not to be ashamed, rightly dividing the word of truth." +
+ 2 Timothy 2:15 +

+
+
{% endblock %}