mirror of
https://github.com/kennethreitz/kjvstudy.org.git
synced 2026-06-05 23:00:16 +00:00
Fix verse sitemap generation - suppress WeasyPrint warnings
The sitemap-verses.xml file was contaminated with WeasyPrint import warnings, causing "Document is empty" errors in Google Search Console. Fixes: - Suppress stdout/stderr during imports to prevent warnings in output - Add error handling to sitemap-verses endpoint - Regenerate clean sitemap-verses.xml (6.3MB, 31,102 verses) The file now starts with proper XML declaration instead of error messages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -26,13 +26,26 @@ Usage:
|
||||
git commit -m "Update verse sitemap"
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# Suppress WeasyPrint warnings during import
|
||||
# Redirect stdout temporarily to suppress import warnings
|
||||
from io import StringIO
|
||||
old_stdout = sys.stdout
|
||||
old_stderr = sys.stderr
|
||||
sys.stdout = StringIO()
|
||||
sys.stderr = StringIO()
|
||||
|
||||
# Add parent directory to path to import kjv module
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
from kjvstudy_org.kjv import bible
|
||||
|
||||
# Restore stdout/stderr
|
||||
sys.stdout = old_stdout
|
||||
sys.stderr = old_stderr
|
||||
|
||||
|
||||
def generate_verse_sitemap():
|
||||
"""Generate sitemap XML for all verses in the Bible."""
|
||||
|
||||
Reference in New Issue
Block a user