Loading...
Loading...
> Shows contextually similar templates using intelligent scoring algorithm
1import { RelatedTemplates } from '@/components/library';
[RECOMMENDED]: Templates similar to Analytics Dashboard
1<RelatedTemplates currentTemplateId="user-management" limit={3} />
| Prop | Type | Default | Description |
|---|---|---|---|
| currentTemplateId* | string | - | ID of current template (e.g., "user-management") |
| limit | number | 3 | Maximum number of related templates to show |
1// Scoring algorithm (from /lib/search.ts)2const scored = allTemplates3 .filter((t) => t.id !== template.id)4 .map((t) => {5 let score = 0;67 // Same category = +3 points8 if (t.category === template.category) {9 score += 3;10 }1112 // Shared features (each = +1 point)13 const sharedFeatures = t.features.filter((f) =>14 template.features.some((tf) => tf.toLowerCase() === f.toLowerCase())15 );16 score += sharedFeatures.length;1718 // Same badge = +1 point19 if (t.badge && t.badge === template.badge) {20 score += 1;21 }2223 return { template: t, score };24 })25 .sort((a, b) => b.score - a.score)26 .slice(0, limit);