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.
This commit is contained in:
2025-05-26 15:00:42 -04:00
parent 51ea037df3
commit 333497f9ba
2 changed files with 93 additions and 17 deletions
+11 -1
View File
@@ -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
},
)
+82 -16
View File
@@ -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 %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap" rel="stylesheet">
<style>
.commentary-section p {
font-family: 'EB Garamond', Georgia, serif;
font-size: 1.375rem;
line-height: 1.9;
margin-bottom: 1.5rem;
color: white;
font-feature-settings:
"liga" 1,
"dlig" 1,
"kern" 1,
"onum" 1;
text-rendering: optimizeLegibility;
}
.commentary-section li {
font-family: 'EB Garamond', Georgia, serif;
font-size: 1.25rem;
line-height: 1.8;
color: white;
}
.commentary-section strong {
color: white;
font-weight: 600;
}
.commentary-section em {
color: rgba(255, 255, 255, 0.9);
font-style: italic;
}
</style>
{% endblock %}
{% block schema_type %}Book{% endblock %}
{% block structured_data %},
"name": "{{ book }} - Authorized King James Version",
@@ -57,22 +95,50 @@
{% endfor %}
</div>
<div class="text-center mt-4" style="padding: 1.5rem; background: var(--surface-color); border-radius: var(--radius-lg); margin-top: 3rem; border: 1px solid var(--border-light);">
<h3 style="color: var(--primary-color); margin: 0 0 1rem; font-family: var(--font-display);">
📚 Book Commentary
</h3>
<p style="color: var(--text-secondary); margin: 0 0 1rem; line-height: 1.6;">
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.
</p>
<a href="/book/{{ book }}/commentary" class="nav-button" style="display: inline-block;">
Read {{ book }} Commentary
</a>
<p style="color: var(--text-secondary); margin-top: 1rem; font-style: italic; font-size: 0.9rem;">
"Study to shew thyself approved unto God, a workman that needeth not to be ashamed, rightly dividing the word of truth."
<br>
<strong style="color: var(--primary-color);">2 Timothy 2:15</strong>
</p>
<div class="commentary-container" style="margin-top: 3rem;">
<div class="commentary-section" style="background: var(--surface-color); border-radius: var(--radius-lg); padding: 2rem; border: 1px solid var(--border-light); box-shadow: var(--shadow-sm); color: white;">
<h2 style="color: white; margin-top: 0; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border-light); font-family: 'Playfair Display', serif; font-size: 2rem; margin-bottom: 1.5rem;">
📚 Commentary on {{ book }}
</h2>
<div style="margin-bottom: 2rem;">
<h3 style="color: white; font-family: 'Playfair Display', serif; font-size: 1.75rem; margin: 2rem 0 1rem 0;">Introduction</h3>
{{ introduction|safe }}
</div>
<div style="margin-bottom: 2rem;">
<h3 style="color: white; font-family: 'Playfair Display', serif; font-size: 1.75rem; margin: 2rem 0 1rem 0;">Historical Context</h3>
{{ historical_context|safe }}
</div>
<div style="margin-bottom: 2rem;">
<h3 style="color: white; font-family: 'Playfair Display', serif; font-size: 1.75rem; margin: 2rem 0 1rem 0;">Major Themes</h3>
{{ themes|safe }}
</div>
<div style="margin-bottom: 2rem;">
<h3 style="color: white; font-family: 'Playfair Display', serif; font-size: 1.75rem; margin: 2rem 0 1rem 0;">Key Passages</h3>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; margin-top: 1.5rem;">
{% for highlight in highlights %}
<div style="background: rgba(255, 235, 59, 0.1); border-radius: var(--radius-md); padding: 1.25rem; border-left: 4px solid var(--accent-color);">
<h4 style="font-weight: 600; margin: 0 0 0.5rem; color: white;">{{ highlight.reference }}</h4>
<p style="margin: 0; color: white; line-height: 1.5; font-size: 1.2rem;">{{ highlight.description }}</p>
</div>
{% endfor %}
</div>
</div>
<div style="text-align: center; margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--border-light);">
<a href="/book/{{ book }}/commentary" class="nav-button nav-button-primary" style="display: inline-block; font-size: 1.1rem; padding: 0.75rem 1.5rem;">
Read Complete {{ book }} Commentary
</a>
<p style="color: rgba(255, 255, 255, 0.8); margin-top: 1rem; font-style: italic; font-size: 0.9rem;">
"Study to shew thyself approved unto God, a workman that needeth not to be ashamed, rightly dividing the word of truth."
<br>
<strong style="color: #ff6b6b;">2 Timothy 2:15</strong>
</p>
</div>
</div>
</div>
{% endblock %}