Skip to main content
Article Files: content/docs/*.mdx
Category Icons? Learn how to configure icons for categories and content blocks in the Icons Guide.

What is Knowledge Base?

The Knowledge Base is a self-service help center where customers can find answers to common questions without contacting support. It includes:
  • Searchable articles - Full-text search functionality
  • Category organization - Group articles by topic
  • Rich content blocks - Text, images, code, videos, alerts
  • SEO optimized - Each article has its own URL and meta tags
  • Mobile responsive - Perfect on all devices
Benefits:
  • Reduce support tickets by 60-80%
  • 24/7 help for customers
  • Improve SEO with quality content
  • Build customer trust and confidence

Creating Article

1

Copy the Template

Navigate to config/knowledgebase/articles/ and copy the template:
cp _TEMPLATE.ts my-first-article.ts
Naming convention:
  • Use lowercase
  • Use hyphens, not spaces
  • Be descriptive
  • Examples: setup-minecraft-server.ts, how-to-upload-world.ts
2

Fill in Details

Open your new file and update the metadata:
import { KnowledgebaseArticle } from "../types";

export const article: KnowledgebaseArticle = {
  // URL slug (no spaces, lowercase)
  slug: "setup-minecraft-server",
  
  // Article title
  title: "How to Setup a Minecraft Server",
  
  // Brief description (for SEO & search results)
  description: "Step-by-step guide to setting up your Minecraft server in under 5 minutes",
  
  // Category (see categories below)
  category: "game-servers",
  
  // Author name
  author: "Latch Team",
  
  // Publication date (YYYY-MM-DD)
  date: "2026-02-01",
  
  // Reading time in minutes
  readTime: 5,
  
  // Search tags (lowercase)
  tags: ["minecraft", "setup", "beginner", "tutorial"],
  
  // Content blocks (see next step)
  content: [
    // Add your content here
  ]
};
3

Add Content Blocks

Write your article using content blocks (detailed below):
content: [
  {
    type: "heading",
    level: 1,
    content: "How to Setup a Minecraft Server"
  },
  {
    type: "paragraph",
    content: "This guide will walk you through setting up your Minecraft server."
  },
  {
    type: "alert",
    variant: "info",
    content: "This takes about 5 minutes to complete."
  },
  // Add more blocks...
]
4

Register your Article

Open config/knowledgebase/index.ts and add:
// At the top with other imports
import { article as setupMinecraft } from "./articles/setup-minecraft-server";

// In the articles array
export const articles: KnowledgebaseArticle[] = [
  gettingStarted,
  setupMinecraft,  // Add your article here
  // ... other articles
];
5

Test your article

Visit your development site:
http://localhost:3000/knowledgebase/setup-minecraft-server
Check:
  • Article displays correctly
  • Images load
  • Code blocks have copy buttons
  • Search finds your article
  • Category filter works

Content Blocks Reference

Paragraph

Regular text with optional bold formatting:
{
  type: "paragraph",
  content: "This is regular text. Use **bold** for emphasis."
}
Markdown support in paragraphs:
  • **bold**bold
  • Plain text (no italic support yet)

Headings

Create section headers:
// H1 - Main title (use once)
{
  type: "heading",
  level: 1,
  content: "Main Article Title"
}

// H2 - Major sections
{
  type: "heading",
  level: 2,
  content: "Section Title"
}

// H3 - Subsections
{
  type: "heading",
  level: 3,
  content: "Subsection Title"
}

// H4 - Minor sections
{
  type: "heading",
  level: 4,
  content: "Minor Section"
}
Best practices:
  • Use H1 only once (main title)
  • Use H2 for major sections
  • Maintain hierarchy (don’t skip levels)

Code Blocks

Syntax-highlighted code with copy button:
{
  type: "code",
  language: "bash",
  code: `npm install
npm run dev`,
  filename: "terminal"  // Optional
}
Supported languages:
  • bash - Terminal commands
  • javascript / js - JavaScript
  • typescript / ts - TypeScript
  • python - Python
  • java - Java
  • json - JSON
  • yaml - YAML
  • properties - Config files
  • css - CSS
  • html - HTML
  • sql - SQL
Examples:
{
  type: "code",
  language: "bash",
  code: `cd /var/minecraft
./start.sh`,
  filename: "terminal"
}

Images

Add images with captions:
{
  type: "image",
  src: "/images/kb/control-panel.png",
  alt: "Game control panel interface",
  caption: "The main control panel dashboard"  // Optional
}
Image best practices:
  1. File location: Save in public/images/kb/
  2. Naming: Use descriptive names: minecraft-setup-step1.png
  3. Format: PNG or JPG
  4. Size:
    • Maximum width: 1200px
    • Compress with TinyPNG
    • Target: Under 200KB per image
  5. Alt text: Describe the image for accessibility
Example structure:
public/
  images/
    kb/
      minecraft-setup-step1.png
      minecraft-setup-step2.png
      fivem-config-example.jpg

YouTube Videos

Embed YouTube videos:
{
  type: "youtube",
  videoId: "dQw4w9WgXcQ",
  caption: "How to setup your Minecraft server (5:32)"
}
How to get Video ID:
  • From URL: https://www.youtube.com/watch?v=dQw4w9WgXcQ
  • Video ID is: dQw4w9WgXcQ

Alert Box

Highlight important information:
// Info (Blue) - General information
{
  type: "alert",
  variant: "info",
  content: "Tip: This will save you time!"
}

// Success (Green) - Positive outcomes
{
  type: "alert",
  variant: "success",
  content: "Great! You've completed this step."
}

// Warning (Orange) - Caution
{
  type: "alert",
  variant: "warning",
  content: "Make sure to backup your world first!"
}

// Error (Red) - Critical warnings
{
  type: "alert",
  variant: "error",
  content: "STOP! Do not proceed without backing up!"
}

Categories

Organize articles by category:
Category IDDisplay NameIconUse For
getting-startedGetting StartedRocketOnboarding, first steps
game-serversGame ServersGamepadGame-specific tutorials
billingBilling & AccountCredit CardPayments, account management
technicalTechnicalCodeAdvanced configurations
securitySecurityShieldSecurity, DDoS, backups
troubleshootingTroubleshootingWrenchFixing issues
Add a category: Edit config/knowledgebase/index.ts:
export const categories: KnowledgebaseCategory[] = [
  {
    id: "getting-started",
    name: "Getting Started",
    icon: "rocket",
    description: "New to hosting? Start here!"
  },
  // Add your custom category
  {
    id: "custom-category",
    name: "Custom Category",
    icon: "grid",
    description: "Description of your category"
  }
];

Page Configuration

Customize the knowledge base landing page appearance and content.
Config File: config/pages/knowledgebase.ts

Hero Section

Configure the main header area with search:
export const knowledgebasePageConfig = {
  hero: {
    title: "How Can We",
    highlight: "Help You",  // Displayed in brand color
    subtitle: "Search our knowledge base for guides, tutorials, and solutions to common questions.",
    backgroundImage: "/assets/kb-hero-bg.jpg",
    searchPlaceholder: "Search for articles..."
  },
  // ... other config
};
Options:
FieldTypeDescriptionExample
titlestringMain title text”How Can We”
highlightstringHighlighted text (brand colored)“Help You”
subtitlestringDescription below title”Search our knowledge base…”
backgroundImagestringHero background image path”/assets/kb-hero-bg.jpg”
searchPlaceholderstringSearch input placeholder”Search for articles…”
Visual Example: The hero displays as: “How Can We Help You?” where “Help You” is in your brand color. Showcase top articles on the main page:
popularArticles: {
  enabled: true,
  title: "Popular Articles",
  subtitle: "Most viewed articles this month",
  count: 3  // Number of articles to display
}
Options:
FieldTypeDescriptionDefault
enabledbooleanShow/hide popular sectiontrue
titlestringSection heading”Popular Articles”
subtitlestringSection description”Most viewed…”
countnumberNumber of articles to show3
Popular articles are taken from the first N articles in your articles array. Manually reorder articles in config/knowledgebase/index.ts to control which appear.

Categories Section

Control category filter buttons:
categories: {
  enabled: true  // Set to false to hide categories
}
Options:
FieldTypeDescription
enabledbooleanShow/hide category filters
When categories are disabled, users can only browse all articles or use search. Consider keeping this enabled for better UX.

Articles Section

Configure article listings and empty states:
articles: {
  titleAllArticles: "All Articles",
  titleSearchResults: "Search Results",
  showingResultsText: "Showing {count} results for",
  noArticlesTitle: "No articles found",
  noArticlesDescription: "We couldn't find any articles matching your search.",
  noArticlesCategoryDescription: "No articles in this category yet. Check back soon!",
  viewAllButton: "View All Articles"
}
Options:
FieldTypeDescription
titleAllArticlesstringTitle when viewing all articles
titleSearchResultsstringTitle when searching
showingResultsTextstringSearch results count text
noArticlesTitlestringEmpty state heading
noArticlesDescriptionstringEmpty state for search
noArticlesCategoryDescriptionstringEmpty state for categories
viewAllButtonstringButton text to clear filters

Help CTA Section

Bottom call-to-action for support:
helpCta: {
  enabled: true,
  title: "Still need help?",
  description: "Can't find what you're looking for? Our support team is here to help.",
  buttons: [
    {
      text: "Contact Support",
      href: "/contact",
      primary: true  // Uses brand color
    },
    {
      text: "Join Discord",
      href: "https://discord.gg/latch",
      primary: false  // Secondary style
    }
  ]
}
Options:
FieldTypeDescription
enabledbooleanShow/hide help CTA
titlestringCTA heading
descriptionstringCTA description
buttonsarrayArray of button objects
Button Object:
FieldTypeDescription
textstringButton label
hrefstringLink URL
primarybooleantrue = brand colored, false = secondary
Primary buttons use your brand color. Non-primary buttons have a secondary gray style. External links (Discord, etc.) automatically open in new tabs.

Complete Configuration Example

export const knowledgebasePageConfig = {
  hero: {
    title: "How Can We",
    highlight: "Help You",
    subtitle: "Search our knowledge base for guides, tutorials, and solutions to common questions.",
    backgroundImage: "/assets/kb-hero-bg.jpg",
    searchPlaceholder: "Search for articles..."
  },
  popularArticles: {
    enabled: true,
    title: "Popular Articles",
    subtitle: "Most viewed articles this month",
    count: 3
  },
  articles: {
    titleAllArticles: "All Articles",
    titleSearchResults: "Search Results",
    showingResultsText: "Showing {count} results for",
    noArticlesTitle: "No articles found",
    noArticlesDescription: "We couldn't find any articles matching your search.",
    noArticlesCategoryDescription: "No articles in this category yet. Check back soon!",
    viewAllButton: "View All Articles"
  },
  categories: {
    enabled: true
  },
  helpCta: {
    enabled: true,
    title: "Still need help?",
    description: "Can't find what you're looking for? Our support team is here to help.",
    buttons: [
      {
        text: "Contact Support",
        href: "/contact",
        primary: true
      },
      {
        text: "Join Discord",
        href: "https://discord.gg/latch",
        primary: false
      }
    ]
  }
};

Styling & Theming

The knowledge base automatically uses your brand color from config/branding.ts.

Automatic Brand Color Integration

All interactive elements automatically adapt to your brand color:
  • Search bar focus state
  • Category filter buttons (when selected)
  • Popular article cards borders and backgrounds
  • Call-to-action buttons (primary)
  • Article category badges
  • Link hover states
Example:
// config/branding.ts
export const brandConfig = {
  name: "YourHost",
  color: "#a855f7"  // Purple - this applies everywhere
};
No additional styling configuration needed! Change your brand color once and the entire knowledge base updates automatically.

Content Block Styling

All content blocks have consistent spacing:
Block TypeVertical SpacingPadding
Paragraphs24px bottom marginNone
Headings32px top, 16px bottomNone
Lists24px bottom marginNone
Code Blocks24px top & bottom16px all sides
Images24px top & bottomNone
YouTube24px top & bottomNone
Alerts24px top & bottom20px all sides

Responsive Design

The knowledge base is fully responsive: Mobile (< 640px):
  • Single column article grid
  • Horizontal scrolling categories
  • Reduced text sizes
  • Touch-optimized buttons
Tablet (640px - 1024px):
  • 2-column article grid
  • All features visible
  • Medium text sizes
Desktop (> 1024px):
  • 3-column article grid
  • Full feature set
  • Large text sizes

SEO Optimization

Per-Article SEO

Each article automatically generates:
// Automatically generated from article metadata
<title>{article.title} | Your Brand Knowledge Base</title>
<meta name="description" content="{article.description}" />
<meta name="keywords" content="{article.tags.join(', ')}" />
<meta property="og:title" content="{article.title}" />
<meta property="og:description" content="{article.description}" />
<meta property="og:type" content="article" />
<meta property="article:author" content="{article.author}" />
<meta property="article:published_time" content="{article.date}" />

Best SEO Practices

  1. Title Optimization:
    • Keep under 60 characters
    • Include target keyword
    • Be descriptive and unique
    • Example: “How to Setup Minecraft Server in 5 Minutes”
  2. Description Optimization:
    • 120-160 characters
    • Include main keyword
    • Compelling summary
    • Example: “Step-by-step guide to setting up your Minecraft server with automatic backups and DDoS protection in under 5 minutes.”
  3. Tag Strategy:
    • 3-7 tags per article
    • Mix of specific and general
    • Use lowercase
    • Example: ["minecraft", "setup", "beginner", "tutorial", "java-edition"]
  4. Content Structure:
    • Use proper heading hierarchy (H1 → H2 → H3)
    • Include alt text for all images
    • Add captions to images and videos
    • Break up long paragraphs
  5. Internal Linking:
    • Link to related articles in content
    • Use descriptive anchor text
    • Example: “Learn about server backups

Search Functionality

How Search Works

The built-in search indexes:
  • Article titles (highest weight)
  • Article descriptions (medium weight)
  • Article tags (medium weight)
  • Category names (low weight)
Search features:
  • Real-time results as you type
  • Case-insensitive matching
  • Partial word matching
  • Can combine with category filters

Search Algorithm

// Priority order:
1. Title exact match (100 points)
2. Title partial match (75 points)
3. Description match (50 points)
4. Tag match (40 points)
5. Category match (25 points)
Articles are ranked by total points and displayed in order.

Best Practices

Article Writing

Good:
  • “How to Setup a Minecraft Server”
  • “Fixing Connection Timeout Errors”
  • “Understanding Server Resource Usage”
Bad:
  • “Minecraft”
  • “Problems”
  • “Resources”
Begin every article with:
  1. What the article covers
  2. Who it’s for (beginner/advanced)
  3. Estimated time to complete
  4. Any prerequisites
{
  type: "paragraph",
  content: "This guide will show you how to install plugins on your Minecraft server. Perfect for server admins with basic experience. Takes about 10 minutes."
},
{
  type: "alert",
  variant: "info",
  content: "Prerequisites: You need FTP access and a running Minecraft server."
}
  • Add screenshots for complex steps
  • Use alert boxes to highlight warnings
  • Include code blocks with examples
  • Embed tutorial videos when available
Rule of thumb: One image or code block per 200-300 words.
Before publishing:
  1. Follow your own instructions
  2. Have a beginner test them
  3. Note any confusing steps
  4. Add clarifications
Common issues:
  • Assuming knowledge (explain acronyms)
  • Skipping “obvious” steps
  • Not mentioning where to find things
  • Missing error handling instructions
  • Add “Last updated” in article metadata
  • Review articles quarterly
  • Update screenshots when UI changes
  • Archive outdated articles (don’t delete)
// Add to article metadata
lastUpdated: "2026-02-06",  // Optional field

Content Organization

Article Structure Template:
content: [
  // 1. Introduction
  { type: "heading", level: 1, content: "Main Title" },
  { type: "paragraph", content: "Brief overview..." },
  { type: "alert", variant: "info", content: "Who this is for..." },
  
  // 2. Prerequisites (if any)
  { type: "heading", level: 2, content: "Before You Start" },
  { type: "list", items: ["Requirement 1", "Requirement 2"] },
  
  // 3. Main Content
  { type: "heading", level: 2, content: "Step 1: First Action" },
  { type: "paragraph", content: "Explanation..." },
  { type: "image", src: "...", alt: "..." },
  
  { type: "heading", level: 2, content: "Step 2: Second Action" },
  { type: "paragraph", content: "Explanation..." },
  { type: "code", language: "bash", code: "..." },
  
  // 4. Troubleshooting
  { type: "heading", level: 2, content: "Common Issues" },
  { type: "heading", level: 3, content: "Problem: Error X" },
  { type: "paragraph", content: "Solution..." },
  
  // 5. Next Steps
  { type: "heading", level: 2, content: "What's Next?" },
  { type: "paragraph", content: "Links to related articles..." },
]

Performance Tips

  1. Optimize Images:
    • Use WebP format when possible
    • Compress before uploading (target under 200KB)
    • Use appropriate dimensions (max 1200px width)
    • Lazy loading is automatic
  2. Limit Article Count:
    • Start with 10-15 quality articles
    • Add more based on actual customer questions
    • Don’t create articles “just because”
  3. Code Block Length:
    • Keep under 50 lines
    • For longer code, link to external repo
    • Use comments to explain complex parts
  4. Video Embedding:
    • YouTube embeds are lightweight
    • Prefer embedding over hosting
    • Keep videos under 10 minutes
    • Add timestamps in caption

Troubleshooting

Check:
  1. Article is exported correctly: export const article = {...}
  2. Article is imported in index.ts
  3. Article is added to articles array
  4. File has .ts extension
  5. No TypeScript errors (npm run build)
# Test the build
npm run build

# Check for your article slug
# Should show: /knowledgebase/your-article-slug
Solutions:
  1. Verify image path starts with /
  2. Check file exists in public/ folder
  3. Image names are case-sensitive
  4. Try clearing Next.js cache:
rm -rf .next
npm run dev
Reasons:
  1. Article title/description too different from search term
  2. Missing relevant tags
  3. Category filter active
Fix: Add more descriptive tags and improve title/description.
Check:
  1. Language is supported (see Content Blocks section)
  2. Language name is lowercase
  3. Code is properly escaped in TypeScript string
// Good
code: `const x = 1;`

// Bad - will break
code: "const x = `template`;"  // Quotes inside string
Common causes:
  1. Brand color not set in config/branding.ts
  2. CSS cache issue - hard refresh (Ctrl+Shift+R)
  3. Custom CSS conflicting
Solution:
# Clear Next.js cache
rm -rf .next
npm run dev

Advanced Features

While lists support bold text, you can also include article links:
{
  type: "list",
  items: [
    "First complete the **[server setup guide](/knowledgebase/setup-guide)**",
    "Then configure **[automatic backups](/knowledgebase/backups)**",
    "Finally, enable **[DDoS protection](/knowledgebase/ddos)**"
  ]
}

Multi-Language Support

Multi-language support is not built-in. Consider these approaches:
Option 1: Separate Article Files
// articles/how-to-setup-en.ts
export const article = {
  slug: "how-to-setup",
  title: "How to Setup",
  // English content
};

// articles/how-to-setup-es.ts
export const article = {
  slug: "como-configurar",
  title: "Cómo Configurar",
  // Spanish content
};
Option 2: Use External Service
  • Integrate with i18n library
  • Use Crowdin/Lokalise for translations
  • Requires custom code modifications

Analytics Integration

Track knowledge base usage:
// Add to ArticleClient.tsx
useEffect(() => {
  // Google Analytics
  gtag('event', 'article_view', {
    article_slug: article.slug,
    article_category: article.category
  });
  
  // Or your analytics tool
  analytics.track('Article Viewed', {
    slug: article.slug,
    title: article.title
  });
}, [article]);

Custom Content Blocks

Want a custom block type? Extend the system:
1

Add to Type Definition

Edit config/knowledgebase/types.ts:
export type ContentBlock = 
  | ParagraphBlock
  | HeadingBlock
  // ... existing types
  | CustomBlock;  // Add your type

interface CustomBlock {
  type: "custom";
  // Your custom properties
  data: string;
}
2

Create Renderer Component

Edit components/knowledgebase/ContentRenderer.tsx:
function BlockRenderer({ block }: { block: ContentBlock }) {
  switch (block.type) {
    // ... existing cases
    case "custom":
      return <CustomBlock data={block.data} />;
  }
}

function CustomBlock({ data }: { data: string }) {
  return (
    <div className="my-6">
      {/* Your custom rendering */}
    </div>
  );
}
3

Use in Articles

content: [
  {
    type: "custom",
    data: "Your custom data"
  }
]

Quick Reference

File Locations

Latch/
├── app/
│   └── knowledgebase/
│       ├── page.tsx                    # Main listing page
│       └── [slug]/
│           ├── page.tsx                # Article page wrapper
│           └── ArticleClient.tsx       # Article display logic
├── components/
│   └── knowledgebase/
│       └── ContentRenderer.tsx         # Content block rendering
├── config/
│   ├── knowledgebase/
│   │   ├── index.ts                    # Articles & categories export
│   │   ├── types.ts                    # TypeScript types
│   │   └── articles/
│   │       ├── _TEMPLATE.ts            # Article template
│   │       └── *.ts                    # Your articles
│   └── pages/
│       └── knowledgebase.ts            # Page configuration
└── public/
    └── images/
        └── kb/                          # Knowledge base images

Common Commands

# Create new article from template
cp config/knowledgebase/articles/_TEMPLATE.ts config/knowledgebase/articles/my-article.ts

# Build and check for errors
npm run build

# Start development server
npm run dev

# Clear cache if styling issues
rm -rf .next && npm run dev

TypeScript Types

// Article structure
interface KnowledgebaseArticle {
  slug: string;
  title: string;
  description: string;
  category: string;
  author: string;
  date: string;
  readTime: number;
  tags: string[];
  content: ContentBlock[];
}

// Category structure
interface KnowledgebaseCategory {
  id: string;
  name: string;
  icon: string;
  description: string;
}

// Content blocks (union type)
type ContentBlock = 
  | ParagraphBlock 
  | HeadingBlock 
  | ListBlock 
  | CodeBlock 
  | ImageBlock 
  | YouTubeBlock 
  | AlertBlock;

Need Help?

Check out the FAQ or join our Discord community for support!