diff --git a/themes/next/components/CategoryGroup.js b/themes/next/components/CategoryGroup.js index 872c4a28..c00b5d1c 100644 --- a/themes/next/components/CategoryGroup.js +++ b/themes/next/components/CategoryGroup.js @@ -1,10 +1,13 @@ +import { siteConfig } from '@/lib/config' import Link from 'next/link' const CategoryGroup = ({ currentCategory, categories }) => { - if (!categories) return <> + if (!categories || categories.length === 0) return <> + const categoryCount = siteConfig('PREVIEW_CATEGORY_COUNT') + const categoryOptions = categories.slice(0, categoryCount) return <>
- {categories.map(category => { + {categoryOptions.map(category => { const selected = currentCategory === category.name return ( { - if (!tags) return <> + if (!tags || tags.length === 0) return <> + + const tagsCount = siteConfig('PREVIEW_TAG_COUNT') + const tagOptions = tags.slice(0, tagsCount) return (
{ - tags.map(tag => { + tagOptions.map(tag => { const selected = tag.name === currentTag return })