fix(markdown): add wiki subdirectory type mappings in inferType

Only `/wiki/concepts/` was mapped; articles under `/wiki/analysis/`,
`/wiki/guides/`, `/wiki/hardware/`, and `/wiki/architecture/` all
silently defaulted to `type='concept'`, producing incorrect metadata
and breaking any type-filtered queries.

Adds explicit path-segment mappings for the four missing subtypes.
`concept` remains the default fallback.
This commit is contained in:
Clevin Canales
2026-04-18 15:11:29 -04:00
committed by Clevin Canales
parent 0acf7d2737
commit 9362e24b36
2 changed files with 17 additions and 0 deletions
+7
View File
@@ -168,6 +168,13 @@ function inferType(filePath?: string): PageType {
if (lower.includes('/projects/') || lower.includes('/project/')) return 'project';
if (lower.includes('/sources/') || lower.includes('/source/')) return 'source';
if (lower.includes('/media/')) return 'media';
// Wiki subdirectory types — checked after generic types so /wiki/projects/ still
// resolves to 'project' via the generic rule above, but wiki-specific subtypes win.
if (lower.includes('/wiki/analysis/')) return 'analysis';
if (lower.includes('/wiki/guides/') || lower.includes('/wiki/guide/')) return 'guide';
if (lower.includes('/wiki/hardware/')) return 'hardware';
if (lower.includes('/wiki/architecture/')) return 'architecture';
if (lower.includes('/wiki/concepts/') || lower.includes('/wiki/concept/')) return 'concept';
return 'concept';
}
+10
View File
@@ -267,4 +267,14 @@ Some content.`;
expect(parseMarkdown('', 'concepts/thing.md').type).toBe('concept');
expect(parseMarkdown('', 'companies/acme.md').type).toBe('company');
});
test('infers type from wiki subdirectory paths', () => {
expect(parseMarkdown('', 'tech/wiki/concepts/longevity-science.md').type).toBe('concept');
expect(parseMarkdown('', 'tech/wiki/guides/team-os-claude-code.md').type).toBe('guide');
expect(parseMarkdown('', 'tech/wiki/analysis/agi-timeline-debate.md').type).toBe('analysis');
expect(parseMarkdown('', 'tech/wiki/hardware/h100-vs-gb200-training-benchmarks.md').type).toBe('hardware');
expect(parseMarkdown('', 'tech/wiki/architecture/kb-infrastructure.md').type).toBe('architecture');
expect(parseMarkdown('', 'finance/wiki/analysis/polymarket-bot-automation-thesis.md').type).toBe('analysis');
expect(parseMarkdown('', 'personal/wiki/concepts/career-regrets-2026-framework.md').type).toBe('concept');
});
});