Add comprehensive SEO improvements

Implement essential SEO features for better search engine visibility:

1. **robots.txt** - Guide search engine crawlers
   - Allow all content except /api/ endpoints
   - Reference sitemap.xml location
   - Set crawl delay to be server-friendly

2. **Open Graph tags** - Improve social media sharing
   - og:type, og:url, og:title, og:description
   - og:site_name for brand consistency
   - Customizable per page via template blocks

3. **Twitter Card tags** - Optimize Twitter previews
   - Summary card format
   - URL, title, and description meta tags

4. **Canonical URLs** - Prevent duplicate content issues
   - Self-referencing canonical links
   - Customizable via template blocks

5. **Structured Data (JSON-LD)** - Help Google understand site structure
   - WebSite schema with search action
   - Enables site search in Google results
   - Extendable per page via structured_data block

All meta tags use template blocks for easy customization on individual pages.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-22 13:26:32 -05:00
parent 9af121a9f8
commit 9edb98dc73
2 changed files with 49 additions and 0 deletions
+16
View File
@@ -9017,6 +9017,22 @@ def health_check():
return {"status": "healthy", "service": "kjv-study"}
@app.get("/robots.txt", response_class=Response)
def robots_txt():
"""Generate robots.txt for search engine crawlers"""
robots_content = """User-agent: *
Allow: /
Disallow: /api/
# Sitemap location
Sitemap: https://kjvstudy.org/sitemap.xml
# Crawl delay (be nice to our servers)
Crawl-delay: 1
"""
return Response(content=robots_content, media_type="text/plain")
def generate_literary_features(book, genre):
"""Generate commentary on literary features of a book"""
+33
View File
@@ -8,10 +8,43 @@
<meta name="description" content="{% block description %}Study the Authorized King James Version Bible{% endblock %}"/>
<!-- Canonical URL -->
<link rel="canonical" href="https://kjvstudy.org{% block canonical_path %}{{ request.url.path }}{% endblock %}"/>
<!-- Open Graph / Facebook -->
<meta property="og:type" content="{% block og_type %}website{% endblock %}"/>
<meta property="og:url" content="https://kjvstudy.org{{ request.url.path }}"/>
<meta property="og:title" content="{% block og_title %}{% block title_text %}Authorized King James Version Bible{% endblock %}{% endblock %}"/>
<meta property="og:description" content="{% block og_description %}{% block description_text %}Study the Authorized King James Version Bible{% endblock %}{% endblock %}"/>
<meta property="og:site_name" content="KJV Study"/>
<!-- Twitter Card -->
<meta name="twitter:card" content="summary"/>
<meta name="twitter:url" content="https://kjvstudy.org{{ request.url.path }}"/>
<meta name="twitter:title" content="{% block twitter_title %}{% block title_plain %}Authorized King James Version Bible{% endblock %}{% endblock %}"/>
<meta name="twitter:description" content="{% block twitter_description %}{% block description_plain %}Study the Authorized King James Version Bible{% endblock %}{% endblock %}"/>
<link rel="stylesheet" href="/static/tufte.css"/>
{% block head %}{% endblock %}
<!-- Structured Data (Schema.org) -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "KJV Study",
"url": "https://kjvstudy.org",
"description": "Study the Authorized King James Version Bible with commentary, study guides, and biblical resources",
"potentialAction": {
"@type": "SearchAction",
"target": "https://kjvstudy.org/search?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
{% block structured_data %}{% endblock %}
<style>
/* Color scheme variables */
:root {