X Enterprises
nuxt-x-affiliate

Category Index

Inline category grid for category landing pages. Pairs recent posts per category with a "Browse all" link.

Category Index

The XAFCategoryIndex component renders a category landing page where each card shows the category name, description, count, and the 3 most recent reviews in that category. For a pure category list with no per-category content, use <XAFTaxonomyArchive> instead.

Components

<XAFCategoryIndex />

<XAFCategoryIndex :categories="categories" :columns="2" />

Props

PropTypeDefaultDescription
categoriesCategoryWithPosts[]requiredEach category has slug, label, optional description, optional image, and posts: Review[]
columns2 | 32Grid columns at full width
postsPerCategorynumber3Max number of recent posts shown per category
titlestring'Browse by Category'Page heading
showAllHrefstringOptional "Browse all categories" link target

Category shape

interface CategoryWithPosts {
  slug: string
  label: string
  description?: string
  image?: string
  posts: Review[]   // already sorted by publishedAt desc
  count?: number    // total posts in category (shown if posts.length < count)
}

Tips

  • Use this for the homepage "Browse by Category" section. For a dedicated /categories page with no per-category post lists, use <XAFTaxonomyArchive>.
  • Compute the posts: Review[] per category on the server (Nuxt Content query, CMS query) — the component is purely presentational.
  • If a category has more than postsPerCategory posts, render a "View all in {label}" link to the category page.

AI Context

component: XAFCategoryIndex
package: "@xenterprises/nuxt-x-affiliate"
use-when: Homepage "Browse by Category" grid with recent posts per category
Copyright © 2026