# Blog Templates Local Testing Guide

**Last Updated:** 2026-01-09

Quick guide for testing blog templates on localhost.

## Quick Start

### 1. Start Local Server

From the project root directory. **Use the router** so `/insights/lexikon/{slug}/` URLs work (PHP built-in server does not process .htaccess):

```bash
php -S localhost:8003 router.php
```

### 2. Access Blog Pages

Once the server is running, you can access:

#### Blog Index

```
http://localhost:8003/insights/
```

#### Category Archives

```
http://localhost:8003/insights/lexikon/
http://localhost:8003/insights/ratgeber/
http://localhost:8003/insights/inside-ordio/
```

#### Single Posts

```
http://localhost:8003/insights/lexikon/leitfaden-zur-finanzbuchhaltung/
http://localhost:8003/insights/ratgeber/dienstplan-erstellen/
http://localhost:8003/insights/inside-ordio/ordio-in-neuem-design/
```

#### Topic Hubs

```
http://localhost:8003/insights/topics/zeiterfassung/
http://localhost:8003/insights/topics/dienstplan/
```

## File Locations

### Templates

- **Index:** `v2/pages/blog/index.php`
- **Category:** `v2/pages/blog/category.php`
- **Single Post:** `v2/pages/blog/post.php`
- **Topic Hub:** `v2/pages/blog/topic-hub.php`

### Components

- `v2/components/blog/PostCard.php`
- `v2/components/blog/PostHeader.php`
- `v2/components/blog/PostContent.php`
- `v2/components/blog/Pagination.php`
- `v2/components/blog/CategoryNav.php`
- `v2/components/blog/Breadcrumbs.php`
- `v2/components/blog/TopicHubHero.php`

### Data Files

- **Posts:** `v2/data/blog/posts/{category}/{slug}.json`
- **Categories:** `v2/data/blog/categories.json`
- **Topics:** `v2/data/blog/topics.json`

### Helper Functions

- `v2/config/blog-template-helpers.php`
- `v2/config/blog-meta-generator.php`
- `v2/config/blog-schema-generator.php`

## Testing Checklist

**Note:** For comprehensive testing, see [Testing Checklist](TESTING_CHECKLIST.md)

### Basic Functionality

- [x] Blog index loads and displays posts ✅
- [x] Category archives filter correctly ✅
- [x] Single posts display content ✅
- [x] Pagination works ✅ (URL-based, starts at page 1)
- [x] Category navigation works ✅
- [x] Breadcrumbs display correctly ✅
- [x] Featured post hero section displays ✅
- [x] WordPress image fallback works ✅

### Data Validation

- [x] All 99 posts are accessible ✅
- [x] Post content displays correctly ✅
- [x] Featured images load (with fallback) ✅
- [x] Related posts appear ✅
- [x] Meta tags are present ✅
- [x] Schema markup is valid ✅

### URL Structure

- [x] URLs match WordPress structure (`/insights/{category}/{slug}/`) ✅
- [x] No 404 errors ✅
- [x] Trailing slashes work correctly ✅
- [x] Category URLs work ✅

## Troubleshooting

### Posts Not Loading

1. Check that JSON files exist in `v2/data/blog/posts/{category}/`
2. Run validation script: `php scripts/blog/validate-templates.php`
3. Check PHP error logs

### Images Not Displaying

- Images are referenced as `/assets/blog-images/{filename}.webp`
- Actual images need to be downloaded and converted to WebP
- Check image paths in post JSON files

### 404 Errors

- **PHP built-in server:** Use `php -S localhost:8003 router.php` (not `-t .` alone). The built-in server does NOT process .htaccess; `router.php` replicates blog URL rewrites.
- **Apache/Docker:** Ensure `.htaccess` rewrite rules are active and mod_rewrite is enabled.

### Component Errors

- Check that component files exist in `v2/components/blog/`
- Verify helper functions are loaded
- Check PHP error logs for specific issues

## Sample Post URLs to Test

### Lexikon (54 posts)

- `/insights/lexikon/leitfaden-zur-finanzbuchhaltung/`
- `/insights/lexikon/lohnabrechnung/`
- `/insights/lexikon/arbeitszeitmodelle/`

### Ratgeber (37 posts)

- `/insights/ratgeber/dienstplan-erstellen/`
- `/insights/ratgeber/zeiterfassung-gesetz/`
- `/insights/ratgeber/arbeitsstunden-pro-monat/`

### Inside Ordio (8 posts)

- `/insights/inside-ordio/ordio-in-neuem-design/`
- `/insights/inside-ordio/product-updates-q4-2024/`

## Next Steps

After local testing:

1. ✅ Fix any issues found (Completed 2026-01-09)
2. ⏳ Optimize images (convert to WebP) - Requires image download
3. ✅ Test performance (PageSpeed Insights) - Ready for testing
4. ✅ Validate SEO (schema, meta tags) - Ready for validation
5. ✅ Test accessibility - Ready for testing
6. ⏳ Deploy to staging/production - Ready when migration begins

## Related Documentation

- [Testing Checklist](TESTING_CHECKLIST.md) - Comprehensive testing guide
- [Template Development Guide](TEMPLATE_DEVELOPMENT_GUIDE.md) - Development details
- [Blog Template Best Practices](BLOG_TEMPLATE_BEST_PRACTICES.md) - Best practices
