Files
kjvstudy.org/kjvstudy_org/templates/study_guide_detail.html
T
kennethreitz c5e71d652e Add meta description tags to all major page templates
- Add description blocks to verse, chapter, book, and study guide templates
- Include "KJV" in descriptions for better SEO (commonly searched term)
- Verse pages now show verse text in description (155 chars)
- Chapter pages show book/chapter info with first verse excerpt
- Book pages include book introduction excerpt when available
- Homepage and other index pages have descriptive meta tags
- All templates now have proper SEO-friendly meta descriptions

Verified all other resource templates already had descriptions.
All tests passing (268 passed, 1 skipped).

🤖 Generated with Claude Code
https://claude.com/claude-code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 22:16:17 -05:00

225 lines
7.5 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ guide.title }} - Bible Study Guide - KJV Bible{% endblock %}
{% block description %}{{ guide.description }}{% endblock %}
{% block og_type %}article{% endblock %}
{% block og_title %}{{ guide.title }} - Bible Study Guide{% endblock %}
{% block og_description %}{{ guide.description }}{% endblock %}
{% block structured_data %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": {{ guide.title | tojson }},
"description": {{ guide.description | tojson }},
"author": {
"@type": "Organization",
"name": "KJV Study"
},
"publisher": {
"@type": "Organization",
"name": "KJV Study",
"url": "https://kjvstudy.org"
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://kjvstudy.org{{ request.url.path }}"
},
"about": {
"@type": "Thing",
"name": "Bible Study"
}
}
</script>
{% endblock %}
{% block head %}
<style>
.guide-actions {
margin: 1.25rem 0;
}
.guide-download-btn {
display: inline-flex;
align-items: center;
gap: 0.35rem;
padding: 0.45rem 0.9rem;
font-size: 0.9rem;
color: var(--text-secondary, #666);
background: var(--code-bg, #f8f8f8);
border: 1px solid var(--border-color, #ddd);
border-radius: 4px;
text-decoration: none;
transition: all 0.2s;
}
.guide-download-btn:hover {
background: var(--bg-color, #fff);
border-color: var(--link-color);
color: var(--link-color);
}
.guide-download-btn svg {
width: 16px;
height: 16px;
}
@media print {
.guide-actions,
.guide-download-btn {
display: none;
}
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Function to link verse references in text
function linkVerseReferences(element) {
if (!element) return;
// Get all text nodes
const walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT, null, false);
const textNodes = [];
let node;
while (node = walker.nextNode()) {
textNodes.push(node);
}
textNodes.forEach(function(textNode) {
let text = textNode.textContent;
let changed = false;
// First, handle comma-separated verse lists like "Psalms 7:17, 9:2, 18:13"
// Pattern: Book chapter:verse, chapter:verse, chapter:verse...
text = text.replace(/\b(\d?\s?[A-Z][a-z]+(?:\s+[A-Z][a-z]+)?)\s+((?:\d+:\d+(?:-\d+)?(?:\s*,\s*)?)+)/g, function(match, book, verseList) {
book = book.trim();
// Check if this is actually a comma-separated list
if (!verseList.includes(',')) {
// Single verse, will be handled by the next regex
return match;
}
changed = true;
// Split by comma and process each verse reference
var verses = verseList.split(/\s*,\s*/);
var links = verses.map(function(verseRef) {
verseRef = verseRef.trim();
var parts = verseRef.match(/^(\d+):(\d+)(?:-(\d+))?$/);
if (parts) {
var chapter = parts[1];
var verseStart = parts[2];
var verseEnd = parts[3];
if (verseEnd) {
return '<a href="/book/' + book + '/chapter/' + chapter + '#verse-' + verseStart + '-' + verseEnd + '">' + book + ' ' + chapter + ':' + verseStart + '-' + verseEnd + '</a>';
} else {
return '<a href="/book/' + book + '/chapter/' + chapter + '/verse/' + verseStart + '">' + book + ' ' + chapter + ':' + verseStart + '</a>';
}
}
return verseRef;
});
return links.join(', ');
});
// Then handle individual verse references like "John 3:16" or "Romans 8:28-29"
// This regex handles book names with optional numbers and spaces
text = text.replace(/\b(\d?\s?[A-Z][a-z]+(?:\s+[A-Z][a-z]+)?)\s+(\d+):(\d+)(?:-(\d+))?\b/g, function(match, book, chapter, verseStart, verseEnd) {
changed = true;
book = book.trim();
if (verseEnd) {
return '<a href="/book/' + book + '/chapter/' + chapter + '#verse-' + verseStart + '-' + verseEnd + '">' + match + '</a>';
} else {
return '<a href="/book/' + book + '/chapter/' + chapter + '/verse/' + verseStart + '">' + match + '</a>';
}
});
// Handle chapter-only references like "Psalm 2" or "Genesis 1"
// Must come after verse references to avoid double-matching
text = text.replace(/\b(Psalm|Genesis|Exodus|Isaiah|Daniel|Revelation|Matthew|Mark|Luke|John|Romans|Hebrews|Proverbs|Ecclesiastes|Job)\s+(\d+)\b(?!:)/g, function(match, book, chapter) {
changed = true;
return '<a href="/book/' + book + '/chapter/' + chapter + '">' + match + '</a>';
});
if (changed) {
const span = document.createElement('span');
span.innerHTML = text;
textNode.parentNode.replaceChild(span, textNode);
// Replace the span's children with its contents
while (span.firstChild) {
span.parentNode.insertBefore(span.firstChild, span);
}
span.parentNode.removeChild(span);
}
});
}
// Link verse references in all section content paragraphs
document.querySelectorAll('section p').forEach(function(paragraph) {
// Skip paragraphs that are just margin toggle labels
if (!paragraph.querySelector('.margin-toggle')) {
linkVerseReferences(paragraph);
}
});
});
</script>
{% endblock %}
{% block content %}
<h1>{{ guide.title }}</h1>
<p class="subtitle">{{ guide.description }}</p>
{% if pdf_available and pdf_url %}
<div class="guide-actions">
<a href="{{ pdf_url }}" class="guide-download-btn">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
Download PDF
</a>
</div>
{% endif %}
<nav class="toc">
<h2>Contents</h2>
<ul>
{% for section in guide.sections %}
<li><a href="#section-{{ loop.index }}">{{ section.title }}</a></li>
{% endfor %}
</ul>
</nav>
{% for section in guide.sections %}
{% set section_index = loop.index %}
<section id="section-{{ section_index }}">
<h2>{{ section.title }}</h2>
{% for verse_data in section.verse_texts %}
<p>
<label for="mn-s{{ section_index }}-v{{ loop.index }}" class="margin-toggle"></label>
<input type="checkbox" id="mn-s{{ section_index }}-v{{ loop.index }}" class="margin-toggle"/>
<span class="marginnote">
<strong><a href="{{ verse_data.url }}">{{ verse_data.reference }}</a></strong><br/>
<em>{{ verse_data.text }}</em>
</span>
</p>
{% endfor %}
<p>{{ section.content | format_lists | safe }}</p>
</section>
{% endfor %}
<nav>
<p>
<a href="/study-guides">← Study Guides</a> |
<a href="/">Home</a>
</p>
</nav>
{% endblock %}