# Blog TOC Deployment Checklist

**Last Updated:** 2026-01-18

Pre-deployment checklist for Blog Table of Contents component.

## Pre-Deployment

### Code Validation

- [x] PHP syntax validation passed
- [x] JavaScript syntax validation passed
- [x] CSS syntax validation passed
- [x] All helper functions tested
- [x] Component integration tested
- [x] Edge cases handled

### Testing

- [x] Heading extraction tested (48 headings in test post)
- [x] ID generation tested (unique IDs, German characters)
- [x] TOC building tested (various configurations)
- [x] Validation script tested (28 posts, all passed)
- [x] Edge cases tested (no headings, single heading, many headings)

### Files Created

- [x] `v2/components/blog/BlogTOC.php`
- [x] `v2/js/blog-toc.js`
- [x] `v2/js/blog-toc.min.js` (created via minification)
- [x] `docs/content/blog/components/BLOG_TOC_COMPONENT.md`
- [x] `docs/content/blog/BLOG_TOC_MIGRATION.md`
- [x] `docs/content/blog/BLOG_TOC_IMPLEMENTATION_SUMMARY.md`
- [x] `v2/scripts/blog/test-heading-extraction.php`
- [x] `v2/scripts/blog/test-toc-generation.php`
- [x] `v2/scripts/blog/validate-toc-implementation.php`

### Files Modified

- [x] `v2/config/blog-template-helpers.php` (4 new functions)
- [x] `v2/pages/blog/post.php` (TOC integration)
- [x] `v2/css/blog.css` (TOC styles)
- [x] `minify-assets.js` (added blog-toc.js)
- [x] `docs/content/blog/guides/TEMPLATE_DEVELOPMENT_GUIDE.md`
- [x] `.cursor/rules/blog-templates.mdc`

### Minification

- [x] `blog-toc.js` added to minify script
- [x] Minified file created (`blog-toc.min.js` - 2.2KB, 72.3% reduction)
- [x] Script loading prefers minified version

## Deployment Steps

1. **Verify Files**
   ```bash
   # Check all files exist
   ls -la v2/components/blog/BlogTOC.php
   ls -la v2/js/blog-toc.js
   ls -la v2/js/blog-toc.min.js
   ```

2. **Run Validation**
   ```bash
   php v2/scripts/blog/validate-toc-implementation.php --limit=20
   ```

3. **Test on Staging**
   - Load a blog post with multiple headings
   - Verify TOC appears after scrolling
   - Test clicking TOC items
   - Verify active section highlighting
   - Test on mobile (TOC should be hidden)
   - Test on desktop (TOC should be visible)

4. **Check Browser Console**
   - No JavaScript errors
   - No console warnings
   - Alpine.js loads correctly

5. **Performance Check**
   - Page load time acceptable
   - No layout shifts (CLS)
   - Smooth scrolling

## Post-Deployment

### Monitoring

- [ ] Check error logs for TOC-related errors
- [ ] Monitor page load times
- [ ] Check user feedback
- [ ] Verify TOC appears on posts with headings
- [ ] Verify TOC hidden on posts without headings

### Rollback Plan

If issues arise:

1. Comment out TOC inclusion in `v2/pages/blog/post.php`:
   ```php
   // if (!empty($toc_items)) {
   //     include __DIR__ . '/../../components/blog/BlogTOC.php';
   // }
   ```

2. Comment out script loading:
   ```php
   // $blog_toc_min_path = __DIR__ . '/../../js/blog-toc.min.js';
   // ...
   ```

3. Posts will continue to work normally

## Success Criteria

- ✅ TOC appears on posts with 2+ headings
- ✅ TOC hidden on posts with < 2 headings
- ✅ TOC appears after scrolling 600px
- ✅ Active section highlights correctly
- ✅ Smooth scrolling works
- ✅ No JavaScript errors
- ✅ No performance degradation
- ✅ Mobile: TOC hidden
- ✅ Desktop: TOC visible

## Known Issues

None currently identified.

## Support

- Component docs: `docs/content/blog/components/BLOG_TOC_COMPONENT.md`
- Migration guide: `docs/content/blog/BLOG_TOC_MIGRATION.md`
- Implementation summary: `docs/content/blog/BLOG_TOC_IMPLEMENTATION_SUMMARY.md`
