Your Business Name
Skip to main content

Hub Layout - Organize Collections Beautifully

Collection pages that organize related content beautifully. Think category pages, content hubs, and archives—all with grid layouts and schema markup.

What Is Hub Layout?

Hub layout displays collections of related content in an attractive card grid. Each hub page introduces the category with a description, then showcases child pages with thumbnails and excerpts. Perfect for organizing blog categories, service collections, and content libraries.

How to Create a Hub Layout Page

Quick Start

Hub layout is for collection pages - blog category pages, service collections, documentation hubs. It displays child pages in an attractive card grid.

1. Create a Hub Page

---
// src/pages/services.astro
import Layout from '@theme/layouts/Layout.astro';
import Hero from '@theme/components/sections/Hero.astro';
import CardGrid from '@theme/components/ui/CardGrid.astro';
import IconCard from '@theme/components/ui/IconCard.astro';
import { getCollection } from 'astro:content';

const title = 'Our Services';
const description = 'Professional services for your business';

// Fetch all services from content collection
const services = await getCollection('services');
---

<Layout title={title} description={description}>
  <Hero
    variant="centered"
    heading="Our Services"
    description="Quality solutions for every business need"
  />

  <section class="py-16 bg-white dark:bg-slate-950">
    <div class="container mx-auto px-4">
      <CardGrid columns={3}>
        {services.map((service) => (
          <IconCard
            icon={service.data.icon}
            title={service.data.title}
            description={service.data.description}
            href={`/services/${service.slug}/`}
            ctaText="Learn more"
          />
        ))}
      </CardGrid>
    </div>
  </section>
</Layout>

2. Hub Page with Categories

---
// src/pages/blog/index.astro
import Layout from '@theme/layouts/Layout.astro';
import Hero from '@theme/components/sections/Hero.astro';
import CardGrid from '@theme/components/ui/CardGrid.astro';
import BlogCard from '@theme/components/ui/BlogCard.astro';
import { getCollection } from 'astro:content';

const title = 'Blog - Latest Articles';
const description = 'Tips, guides, and insights';

// Fetch all blog posts
const allPosts = await getCollection('blog');

// Sort by publish date (newest first)
const posts = allPosts.sort(
  (a, b) => b.data.publishDate.valueOf() - a.data.publishDate.valueOf()
);
---

<Layout title={title} description={description}>
  <Hero
    variant="centered"
    heading="Latest Articles"
    description="Tips and insights for growing your business"
  />

  <section class="py-16 bg-white dark:bg-slate-950">
    <div class="container mx-auto px-4">
      <CardGrid columns={3}>
        {posts.map((post) => (
          <BlogCard
            title={post.data.title}
            description={post.data.description}
            publishDate={post.data.publishDate}
            category={post.data.category}
            thumbnail={post.data.thumbnail}
            href={`/blog/${post.slug}/`}
          />
        ))}
      </CardGrid>
    </div>
  </section>
</Layout>

3. What You Get

  • Responsive card grid (1/2/3 columns)
  • Automatic CollectionPage schema markup
  • Featured content badges (optional)
  • Thumbnail images with lazy loading
  • Category filtering (optional)
  • Pagination for large collections (optional)

When to Use Hub Layout

✅ Perfect For:

  • Blog category pages
  • Service collections
  • Documentation hubs
  • Content libraries
  • Resource centers

❌ Not For:

  • Individual blog posts (use Magazine layout)
  • Static pages (use Standard layout)
  • Landing pages (use Minimal layout)

Hub Layout Features

Grid Display

Visually appealing card grid layout

SEO Optimized

CollectionPage schema markup

Featured Content

Highlight key items with badges

Responsive Grid

Adapts to all screen sizes

Explore Other Layouts

Each layout is optimized for specific content types. Choose the right one for your pages.