Add stats page, SEO improvements, and auto-sitemap updates

- Add podcast_stats.py with --json/--upload flags for BunnyCDN
- Add website/stats.html fetching stats from CDN
- Add stats CSS styles
- SEO: shorten title/description, add og:site_name, twitter cards,
  theme-color, image dimensions, consistent favicons and cache-busting
- Add all episode transcript pages to sitemap.xml with lastmod
- Auto-add new episodes to sitemap in publish_episode.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-11 20:17:09 -07:00
parent cee78b5d88
commit 953c501f75
8 changed files with 889 additions and 12 deletions

View File

@@ -17,6 +17,7 @@ import subprocess
import sys
import tempfile
import base64
from datetime import datetime
from pathlib import Path
import ssl
@@ -515,6 +516,33 @@ def sync_episode_media_to_bunny(episode_id: int, already_uploaded: set):
Path(tmp_path).unlink(missing_ok=True)
def add_episode_to_sitemap(slug: str):
"""Add episode transcript page to sitemap.xml."""
sitemap_path = Path(__file__).parent / "website" / "sitemap.xml"
if not sitemap_path.exists():
return
url = f"https://lukeattheroost.com/episode.html?slug={slug}"
content = sitemap_path.read_text()
if url in content:
print(f" Episode already in sitemap")
return
today = datetime.now().strftime("%Y-%m-%d")
new_entry = f""" <url>
<loc>{url}</loc>
<lastmod>{today}</lastmod>
<changefreq>never</changefreq>
<priority>0.7</priority>
</url>
</urlset>"""
content = content.replace("</urlset>", new_entry)
sitemap_path.write_text(content)
print(f" Added episode to sitemap.xml")
def get_next_episode_number() -> int:
"""Get the next episode number from Castopod."""
headers = get_auth_header()
@@ -665,6 +693,9 @@ def main():
shutil.copy2(str(transcript_path), str(website_transcript_path))
print(f" Transcript copied to website/transcripts/")
# Add to sitemap
add_episode_to_sitemap(episode["slug"])
# Step 4: Publish
episode = publish_episode(episode["id"])