mirror of
https://github.com/kennethreitz/kjvstudy.org.git
synced 2026-06-05 23:00:16 +00:00
Integrate topical index system with routes and templates
Add complete topical concordance functionality:
- Import topic functions in server.py
- Create /topics route listing all major topics
- Create /topics/{topic_name} route for topic details
- Build topics.html template with grid layout
- Build topic_detail.html with subtopics and linked verses
- Parse verse references to create clickable links
- Add Topics to sidebar navigation
- Add Topics and Reading Plans to homepage Resources
The topical index organizes 10 major theological themes with
multiple subtopics, providing systematic access to key Scripture
passages by subject with explanatory notes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
|
||||
from .kjv import bible, VerseReference
|
||||
from .cross_references import get_cross_references
|
||||
from .reading_plans import get_plan, get_all_plans, get_plan_summary
|
||||
from .topics import get_all_topics, get_topic, search_topics
|
||||
|
||||
try:
|
||||
from ged4py import GedcomReader
|
||||
@@ -3124,6 +3125,55 @@ def reading_plan_detail(request: Request, plan_id: str):
|
||||
)
|
||||
|
||||
|
||||
@app.get("/topics", response_class=HTMLResponse)
|
||||
def topics_page(request: Request):
|
||||
"""Browse topical index of Bible themes"""
|
||||
books = list(bible.iter_books())
|
||||
topics = get_all_topics()
|
||||
|
||||
breadcrumbs = [
|
||||
{"text": "Home", "url": "/"},
|
||||
{"text": "Topics", "url": None}
|
||||
]
|
||||
|
||||
return templates.TemplateResponse(
|
||||
"topics.html",
|
||||
{
|
||||
"request": request,
|
||||
"topics": topics,
|
||||
"books": books,
|
||||
"breadcrumbs": breadcrumbs
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@app.get("/topics/{topic_name}", response_class=HTMLResponse)
|
||||
def topic_detail(request: Request, topic_name: str):
|
||||
"""View verses for a specific topic"""
|
||||
books = list(bible.iter_books())
|
||||
topic = get_topic(topic_name)
|
||||
|
||||
if not topic:
|
||||
raise HTTPException(status_code=404, detail="Topic not found")
|
||||
|
||||
breadcrumbs = [
|
||||
{"text": "Home", "url": "/"},
|
||||
{"text": "Topics", "url": "/topics"},
|
||||
{"text": topic_name, "url": None}
|
||||
]
|
||||
|
||||
return templates.TemplateResponse(
|
||||
"topic_detail.html",
|
||||
{
|
||||
"request": request,
|
||||
"topic": topic,
|
||||
"topic_name": topic_name,
|
||||
"books": books,
|
||||
"breadcrumbs": breadcrumbs
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@app.get("/book/{book}", response_class=HTMLResponse)
|
||||
def read_book(request: Request, book: str):
|
||||
books = list(bible.iter_books())
|
||||
|
||||
@@ -569,6 +569,7 @@
|
||||
<li><a href="/books">Books</a></li>
|
||||
<li><a href="/verse-of-the-day">Verse of the Day</a></li>
|
||||
<li><a href="/reading-plans">Reading Plans</a></li>
|
||||
<li><a href="/topics">Topics</a></li>
|
||||
<li><a href="/search">Search</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -113,6 +113,10 @@ section a[href^="/book/"] {
|
||||
|
||||
<p><span class="newthought">Theological Studies</span> — Comprehensive explorations of biblical themes: <a href="/biblical-angels">Biblical Angels</a>, <a href="/biblical-prophets">Biblical Prophets</a>, <a href="/biblical-covenants">Biblical Covenants</a>, <a href="/biblical-festivals">Biblical Festivals</a>, <a href="/names-of-god">Names of God</a>, <a href="/parables">Parables of Jesus</a>, <a href="/the-twelve-apostles">The Twelve Apostles</a>, and <a href="/women-of-the-bible">Women of the Bible</a>.</p>
|
||||
|
||||
<p><span class="newthought">Topical Index</span> — A systematic <a href="/topics">concordance of major theological themes</a>, organizing Scripture by subject—Salvation, Prayer, Love, Faith, Forgiveness, the Holy Spirit, and other essential doctrines—each with carefully selected verses and explanatory notes.</p>
|
||||
|
||||
<p><span class="newthought">Reading Plans</span> — Structured <a href="/reading-plans">Bible reading schedules</a> for systematic Scripture study, including chronological, thematic, and testament-specific plans to guide sustained engagement with God's Word.</p>
|
||||
|
||||
<p><span class="newthought">Concordance and Search</span> — A comprehensive <a href="/search">search facility</a> allowing the reader to trace any word or phrase throughout the entire corpus of Scripture, after the manner of Cruden's Complete Concordance.</p>
|
||||
|
||||
<p><span class="newthought">Biblical Geography</span> — <a href="/biblical-maps">Maps and descriptions</a> of those places mentioned in Holy Writ, from the rivers of Babylon to the shores of Galilee, illuminating the geographical context of sacred history.</p>
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ topic_name }} - Topical Index - KJV Study{% endblock %}
|
||||
{% block description %}{{ topic.description }}{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
<style>
|
||||
.topic-overview {
|
||||
max-width: 60%;
|
||||
font-size: 1.2rem;
|
||||
line-height: 1.9;
|
||||
margin: 1.5rem 0;
|
||||
padding: 1rem;
|
||||
border-left: 3px solid var(--border-color-darker);
|
||||
background: var(--code-bg);
|
||||
}
|
||||
|
||||
.subtopics-container {
|
||||
max-width: 70%;
|
||||
margin: 2rem 0;
|
||||
}
|
||||
|
||||
.subtopic-section {
|
||||
margin: 2.5rem 0;
|
||||
}
|
||||
|
||||
.subtopic-header {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
color: var(--link-color);
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.subtopic-description {
|
||||
font-style: italic;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.verses-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.verse-item {
|
||||
margin: 1rem 0;
|
||||
padding-left: 1.5rem;
|
||||
border-left: 2px solid var(--border-color);
|
||||
}
|
||||
|
||||
.verse-ref {
|
||||
font-weight: 600;
|
||||
font-size: 1.05rem;
|
||||
}
|
||||
|
||||
.verse-ref a {
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.verse-ref a:hover {
|
||||
color: var(--link-hover);
|
||||
border-bottom: 1px solid var(--link-hover);
|
||||
}
|
||||
|
||||
.verse-note {
|
||||
color: var(--text-secondary);
|
||||
font-style: italic;
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
.intro-text {
|
||||
max-width: 60%;
|
||||
font-size: 1.2rem;
|
||||
line-height: 1.9;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ topic_name }}</h1>
|
||||
<p class="subtitle">{{ topic.description }}</p>
|
||||
|
||||
<section>
|
||||
<h2>Overview</h2>
|
||||
<div class="topic-overview">
|
||||
This topical index organizes key Scripture passages related to {{ topic_name|lower }}. Each subtopic below addresses a specific aspect of this theme, with carefully selected verses that establish biblical teaching on the subject.
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Subtopics</h2>
|
||||
|
||||
<div class="subtopics-container">
|
||||
{% for subtopic_name, subtopic_data in topic.subtopics.items() %}
|
||||
<div class="subtopic-section">
|
||||
<h3 class="subtopic-header">{{ subtopic_name }}</h3>
|
||||
<p class="subtopic-description">{{ subtopic_data.description }}</p>
|
||||
|
||||
<ul class="verses-list">
|
||||
{% for verse in subtopic_data.verses %}
|
||||
<li class="verse-item">
|
||||
<span class="verse-ref">
|
||||
{% set ref_parts = verse.ref.rsplit(' ', 1) %}
|
||||
{% if ref_parts|length == 2 %}
|
||||
{% set book_name = ref_parts[0] %}
|
||||
{% set chapter_verse = ref_parts[1] %}
|
||||
{% if ':' in chapter_verse %}
|
||||
{% set ch = chapter_verse.split(':')[0] %}
|
||||
{% set v = chapter_verse.split(':')[1] %}
|
||||
{% if '-' not in v %}
|
||||
{# Single verse - make it a link #}
|
||||
<a href="/book/{{ book_name }}/chapter/{{ ch }}/verse/{{ v }}">{{ verse.ref }}</a>
|
||||
{% else %}
|
||||
{# Verse range - link to first verse #}
|
||||
{% set v_start = v.split('-')[0] %}
|
||||
<a href="/book/{{ book_name }}/chapter/{{ ch }}/verse/{{ v_start }}">{{ verse.ref }}</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{# No colon, just display text #}
|
||||
{{ verse.ref }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ verse.ref }}
|
||||
{% endif %}
|
||||
</span>
|
||||
{% if verse.note %}
|
||||
<span class="verse-note">— {{ verse.note }}</span>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Study Guidance</h2>
|
||||
<p class="intro-text"><span class="newthought">Topical study benefits</span> from reading verses in their broader context. Click any reference above to view the complete passage and surrounding verses. Consider comparing how different biblical authors address the same theme across various contexts and time periods.</p>
|
||||
|
||||
<p class="intro-text">Cross-reference study deepens understanding. Many verses listed here connect to other passages—use the cross-references provided on individual verse pages to trace theological themes throughout Scripture.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<p><a href="/topics">← Back to all topics</a></p>
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,97 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Topical Index - KJV Study{% endblock %}
|
||||
{% block description %}Find Bible verses by theme and theological topic{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
<style>
|
||||
.topic-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
||||
gap: 1.5rem;
|
||||
max-width: 90%;
|
||||
margin: 2rem 0;
|
||||
}
|
||||
|
||||
.topic-card {
|
||||
padding: 1.5rem;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.topic-card:hover {
|
||||
border-color: var(--border-color-darker);
|
||||
box-shadow: 0 2px 12px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.topic-name {
|
||||
font-size: 1.4rem;
|
||||
font-weight: 600;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.topic-name a {
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.topic-name a:hover {
|
||||
color: var(--link-hover);
|
||||
}
|
||||
|
||||
.topic-description {
|
||||
font-size: 1rem;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.6;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
.topic-subtopics {
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-tertiary);
|
||||
font-style: italic;
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
|
||||
.intro-text {
|
||||
max-width: 60%;
|
||||
font-size: 1.2rem;
|
||||
line-height: 1.9;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Topical Index</h1>
|
||||
<p class="subtitle">Find Verses by Theme and Subject</p>
|
||||
|
||||
<section>
|
||||
<p class="intro-text"><span class="newthought">Systematic topical study</span> enables thematic exploration of Scripture across both testaments. This concordance organizes key theological and practical themes, providing structured access to related passages that illuminate each subject from multiple biblical perspectives.</p>
|
||||
|
||||
<p class="intro-text">Select a topic below to explore its subtopics and discover the verses that address each theme. Each reference includes contextual notes to aid understanding of its relevance to the broader subject.</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Major Topics</h2>
|
||||
|
||||
<div class="topic-grid">
|
||||
{% for topic_name, topic_data in topics.items() %}
|
||||
<div class="topic-card">
|
||||
<div class="topic-name"><a href="/topics/{{ topic_name }}">{{ topic_name }}</a></div>
|
||||
<div class="topic-description">{{ topic_data.description }}</div>
|
||||
<div class="topic-subtopics">{{ topic_data.subtopics|length }} subtopics</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Using the Topical Index</h2>
|
||||
<p class="intro-text">Each major topic contains multiple subtopics with carefully selected verses. The references provided represent foundational passages for each theme, though they are not exhaustive. Consider these as entry points for deeper study, using cross-references and concordances to expand your exploration.</p>
|
||||
|
||||
<p class="intro-text">Topical study complements sequential Bible reading by allowing focused examination of specific doctrines or practical matters. Compare passages across different books and testaments to grasp the full biblical teaching on any subject.</p>
|
||||
</section>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user