# Template Inventory Keyword Workflow

**Last Updated:** 2026-02-18  
**Purpose:** End-to-end keyword-driven template setup—from seed keywords through SISTRIX discovery, candidate generation, collection, overlap analysis, and prioritization.

## Overview

Templates are driven by **target keywords** (not generic use cases). This workflow ensures:

1. Keyword discovery from Ordio products + FILTERING_GUIDELINES
2. SISTRIX validation for volume/competition
3. Template–keyword mapping for all templates
4. Overlap/merge analysis
5. Prioritization from SISTRIX data

## Data Flow

```mermaid
flowchart TD
    A[template-seed-keywords.json] --> B[discover-template-keywords-sistrix.php]
    B --> C[template-keywords-discovered.json]
    C --> D[generate-template-candidate-keywords.php]
    E[template-registry.json] --> D
    F[keyword-analysis-merged.json] --> D
    D --> G[template-candidate-keywords.json]
    G --> H[collect-template-keywords-sistrix.php]
    H --> I[template-data/id/data/keywords-sistrix.json]
    I --> J[analyze-template-keyword-overlap.php]
    I --> K[generate-template-priority-from-sistrix.php]
    J --> L[template-merge-recommendations.json]
    K --> M[TEMPLATE_PRIORITY_LIST_GENERATED.md]
```

## When to Run

| Script | When |
|--------|------|
| **discover-template-keywords-sistrix.php** | Quarterly; when expanding template topics |
| **generate-template-candidate-keywords.php** | After registry changes; after discovery run |
| **collect-template-keywords-sistrix.php --all** | After candidate keywords update; quarterly refresh |
| **analyze-template-keyword-overlap.php** | After candidate keywords update |
| **analyze-template-remove-candidates.php** | After SISTRIX collection |
| **generate-template-priority-from-sistrix.php** | Quarterly; merge into TEMPLATE_PRIORITY_LIST |
| **generate-template-seo-meta.php --all** | After SISTRIX collection |
| **validate-template-slug-keyword-alignment.php --all** | Before publish; after slug changes |
| **analyze-template-slug-keyword-matrix.php** | When planning slug migrations |

## Credit Budget

| Step | Credits (approx) |
|------|------------------|
| discover (40 seeds × 10 ideas) | ~400 |
| collect --all (28 templates × 11 kw × 5) | ~1,540 |
| **Total full run** | ~2,000 |

Use `--limit` and `--dry-run` to cap usage. Weekly limit: 10,000 (see `v2/config/sistrix-collection-limits.php`).

## Script Reference

| Script | Purpose |
|--------|---------|
| `discover-template-keywords-sistrix.php` | SISTRIX marketplace.keyword.search.ideas from seeds |
| `generate-template-candidate-keywords.php` | Registry + merged (base) + discovered (augment) → template-candidate-keywords.json |
| `collect-template-keywords-sistrix.php` | SISTRIX keyword.seo.metrics → keywords-sistrix.json |
| `analyze-template-keyword-overlap.php` | Find merge candidates (>70% overlap) |
| `analyze-template-remove-candidates.php` | Flag low alignment/volume templates |
| `generate-template-priority-from-sistrix.php` | ROI score → TEMPLATE_PRIORITY_LIST_GENERATED.md |
| `generate-template-seo-meta.php` | keywords-sistrix → seo-meta.json |
| `validate-template-slug-keyword-alignment.php` | Check slug matches primary keyword; German only |
| `analyze-template-slug-keyword-matrix.php` | Output SLUG_KEYWORD_ALIGNMENT_AUDIT.md |

## Merge/Remove Decision Criteria

- **Merge:** >70% keyword overlap; one template supersedes (e.g. shift-planning-basic → schichtplan-excel-vorlage)
- **Deprecate:** Add 301 redirect in .htaccess; set `status: deprecated` in registry
- **Remove:** Only if no traffic, no alignment; document in TEMPLATE_PRIORITY_LIST

## Slug Decision (Before Publish)

**Derive slug from primary keyword** (keywords-sistrix.json). Run `validate-template-slug-keyword-alignment.php --all` before publishing. See TEMPLATE_SLUG_MIGRATION_GUIDE.md.

## Data Consistency Checklist

- [x] All published templates (templates-index-config) have `template-data/{id}/data/keywords-sistrix.json` OR `template-keywords.json`
- [x] All templates in template-candidate-keywords.json
- [x] template-registry.json status matches templates-index-config (published list)
- [x] Deprecated templates have 301 redirect in .htaccess (shift-planning-basic → schichtplan-excel-vorlage)

## Related Documentation

- [TEMPLATE_PRIORITY_LIST.md](../../../v2/systems/excel-template-generator/docs/TEMPLATE_PRIORITY_LIST.md)
- [TEMPLATE_SEO_META_WORKFLOW.md](TEMPLATE_SEO_META_WORKFLOW.md)
- [FILTERING_GUIDELINES.md](../../../v2/systems/excel-template-generator/docs/FILTERING_GUIDELINES.md)
- [TEMPLATE_DATA_COLLECTION_GUIDE.md](TEMPLATE_DATA_COLLECTION_GUIDE.md)
