From 36397378b61a247db8cb3d038d007b16046b261e Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Thu, 20 Nov 2025 19:08:36 -0500 Subject: [PATCH] Integrate topical index system with routes and templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- kjvstudy_org/server.py | 50 ++++++++ kjvstudy_org/templates/base.html | 1 + kjvstudy_org/templates/index.html | 4 + kjvstudy_org/templates/topic_detail.html | 150 +++++++++++++++++++++++ kjvstudy_org/templates/topics.html | 97 +++++++++++++++ 5 files changed, 302 insertions(+) create mode 100644 kjvstudy_org/templates/topic_detail.html create mode 100644 kjvstudy_org/templates/topics.html diff --git a/kjvstudy_org/server.py b/kjvstudy_org/server.py index aa95c49..c9ae13f 100644 --- a/kjvstudy_org/server.py +++ b/kjvstudy_org/server.py @@ -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()) diff --git a/kjvstudy_org/templates/base.html b/kjvstudy_org/templates/base.html index 4c7fbf4..c56bcd5 100644 --- a/kjvstudy_org/templates/base.html +++ b/kjvstudy_org/templates/base.html @@ -569,6 +569,7 @@
  • Books
  • Verse of the Day
  • Reading Plans
  • +
  • Topics
  • Search
  • diff --git a/kjvstudy_org/templates/index.html b/kjvstudy_org/templates/index.html index d6cf92b..b89cc88 100644 --- a/kjvstudy_org/templates/index.html +++ b/kjvstudy_org/templates/index.html @@ -113,6 +113,10 @@ section a[href^="/book/"] {

    Theological Studies — Comprehensive explorations of biblical themes: Biblical Angels, Biblical Prophets, Biblical Covenants, Biblical Festivals, Names of God, Parables of Jesus, The Twelve Apostles, and Women of the Bible.

    +

    Topical Index — A systematic concordance of major theological themes, organizing Scripture by subject—Salvation, Prayer, Love, Faith, Forgiveness, the Holy Spirit, and other essential doctrines—each with carefully selected verses and explanatory notes.

    + +

    Reading Plans — Structured Bible reading schedules for systematic Scripture study, including chronological, thematic, and testament-specific plans to guide sustained engagement with God's Word.

    +

    Concordance and Search — A comprehensive search facility allowing the reader to trace any word or phrase throughout the entire corpus of Scripture, after the manner of Cruden's Complete Concordance.

    Biblical Geography — Maps and descriptions of those places mentioned in Holy Writ, from the rivers of Babylon to the shores of Galilee, illuminating the geographical context of sacred history.

    diff --git a/kjvstudy_org/templates/topic_detail.html b/kjvstudy_org/templates/topic_detail.html new file mode 100644 index 0000000..4c79cc8 --- /dev/null +++ b/kjvstudy_org/templates/topic_detail.html @@ -0,0 +1,150 @@ +{% extends "base.html" %} + +{% block title %}{{ topic_name }} - Topical Index - KJV Study{% endblock %} +{% block description %}{{ topic.description }}{% endblock %} + +{% block head %} + +{% endblock %} + +{% block content %} +

    {{ topic_name }}

    +

    {{ topic.description }}

    + +
    +

    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. +
    +
    + +
    +

    Subtopics

    + +
    + {% for subtopic_name, subtopic_data in topic.subtopics.items() %} +
    +

    {{ subtopic_name }}

    +

    {{ subtopic_data.description }}

    + +
      + {% for verse in subtopic_data.verses %} +
    • + + {% 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 #} + {{ verse.ref }} + {% else %} + {# Verse range - link to first verse #} + {% set v_start = v.split('-')[0] %} + {{ verse.ref }} + {% endif %} + {% else %} + {# No colon, just display text #} + {{ verse.ref }} + {% endif %} + {% else %} + {{ verse.ref }} + {% endif %} + + {% if verse.note %} + — {{ verse.note }} + {% endif %} +
    • + {% endfor %} +
    +
    + {% endfor %} +
    +
    + +
    +

    Study Guidance

    +

    Topical study benefits 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.

    + +

    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.

    +
    + +
    +

    ← Back to all topics

    +
    +{% endblock %} diff --git a/kjvstudy_org/templates/topics.html b/kjvstudy_org/templates/topics.html new file mode 100644 index 0000000..8f10ce6 --- /dev/null +++ b/kjvstudy_org/templates/topics.html @@ -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 %} + +{% endblock %} + +{% block content %} +

    Topical Index

    +

    Find Verses by Theme and Subject

    + +
    +

    Systematic topical study 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.

    + +

    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.

    +
    + +
    +

    Major Topics

    + +
    + {% for topic_name, topic_data in topics.items() %} +
    + +
    {{ topic_data.description }}
    +
    {{ topic_data.subtopics|length }} subtopics
    +
    + {% endfor %} +
    +
    + +
    +

    Using the Topical Index

    +

    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.

    + +

    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.

    +
    +{% endblock %}