Files
kestrelsnest-blog/quick_link_check.py
Eric Wagoner eddd9d2a80 Import WordPress posts and migrate standalone content to Hugo
- Successfully imported 1731 WordPress posts to Hugo markdown format
- Migrated 204+ images from archive to static directory
- Copied standalone directories (curtain, farm, gobbler, house, images, party, revcemetery, railsday, birthday)
- Fixed all internal links to use /legacy prefix for archived content
- Remapped archive links to point to correct Hugo posts
- Fixed Louisville Georgia Cemetery post rendering issue

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 16:23:40 -04:00

54 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""
Quick check of external links
"""
import re
from pathlib import Path
from collections import defaultdict
POSTS_DIR = Path('/Users/ericwagoner/Sites/blog/content/posts')
# Just check a sample of posts first
sample_posts = list(POSTS_DIR.glob('*.md'))[:50]
all_links = set()
for post in sample_posts:
with open(post, 'r', encoding='utf-8') as f:
content = f.read()
# Find all ericwagoner.com links
links = re.findall(r'http://www\.ericwagoner\.com[^\s\)"]+', content)
all_links.update(links)
# Categorize
images = []
html_pages = []
other = []
for url in all_links:
if re.search(r'\.(jpg|jpeg|gif|png)$', url, re.IGNORECASE):
images.append(url)
elif url.endswith('.html') or url.endswith('.htm'):
html_pages.append(url)
else:
other.append(url)
print(f"Sample from first 50 posts:")
print(f" Total unique links: {len(all_links)}")
print(f" Images: {len(images)}")
print(f" HTML pages: {len(html_pages)}")
print(f" Other: {len(other)}")
print("\nSample image links:")
for url in images[:5]:
print(f" {url}")
print("\nSample HTML page links:")
for url in html_pages[:5]:
print(f" {url}")
print("\nSample other links:")
for url in other[:5]:
print(f" {url}")