BunPress Documentation
On this page 23
  verbose: false,
}

Change Frequencies

Available values for changefreq:

ValueDescription
'always'Changes every access
'hourly'Changes every hour
'daily'Changes daily
'weekly'Changes weekly
'monthly'Changes monthly
'yearly'Changes yearly
'never'Archived content

Robots.txt

Basic Setup

Generate a robots.txt file:

const config: BunPressOptions = {
  robots: {
    enabled: true,
  },
}

Custom Rules

Configure crawler access rules:

robots: {
  enabled: true,
  filename: 'robots.txt',

  rules: [
    {
      userAgent: '*',
      allow: ['/'],
      disallow: ['/admin/', '/draft/', '/api/internal/'],
    },
    {
      userAgent: 'Googlebot',
      allow: ['/'],
      crawlDelay: 1,
    },
    {
      userAgent: 'Bingbot',
      allow: ['/'],
      disallow: ['/experimental/'],
      crawlDelay: 2,
    },
  ],

  sitemaps: ['https://docs.myproject.com/sitemap.xml'],
  host: 'https://docs.myproject.com',

  customContent: `

# Additional rules

User-agent: BadBot
Disallow: /
`,
}

Generated Output

Example robots.txt:

User-agent: *
Allow: /
Disallow: /admin/
Disallow: /draft/

User-agent: Googlebot
Allow: /
Crawl-delay: 1

Sitemap: <https://docs.myproject.com/sitemap.xml>
Host: <https://docs.myproject.com>

Meta Tags

Page Metadata

Configure site-wide meta tags:

markdown: {
  title: 'My Documentation',
  meta: {
    description: 'Comprehensive documentation for My Project',
    author: 'Your Name',
    keywords: 'documentation, api, reference',
  },
}

Per-Page Metadata

Override metadata per page using frontmatter:

---

title: API Reference
description: Complete API documentation for My Project
meta:
  og:image: /images/api-preview.png

  twitter:card: summary*large*image
---

# API Reference

Open Graph Tags

BunPress automatically generates Open Graph tags for social sharing:

<meta property="og:title" content="Page Title" />
<meta property="og:description" content="Page description" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://docs.myproject.com/page" />
<meta property="og:image" content="https://docs.myproject.com/og-image.png" />

Twitter Cards

Twitter card meta tags are also generated:

<meta name="twitter:card" content="summary*large*image" />
<meta name="twitter:title" content="Page Title" />
<meta name="twitter:description" content="Page description" />
<meta name="twitter:image" content="https://docs.myproject.com/twitter-image.png" />

Analytics

Fathom Analytics

Privacy-focused analytics with GDPR/CCPA compliance:

fathom: {
  enabled: true,
  siteId: 'YOUR*SITE*ID',
  scriptUrl: 'https://cdn.usefathom.com/script.js',
  defer: true,
  honorDNT: true,  // Respect Do Not Track
  auto: true,
  spa: false,
}

Self-Hosted Analytics

Use your own analytics infrastructure:

selfHostedAnalytics: {
  enabled: true,
  siteId: 'my-docs',
  apiEndpoint: 'https://analytics.mysite.com/collect',
  honorDNT: true,
  trackHashChanges: false,
  trackOutboundLinks: true,
}

SEO Validation

CLI Command

Check SEO issues across all pages:

bunpress seo:check

This validates:

  • Title length (50-60 characters recommended)
  • Description length (150-160 characters recommended)
  • Heading structure (proper h1, h2, h3 hierarchy)
  • Image alt text
  • Internal link validity
  • Meta tag presence

Auto-Fix Mode

Automatically fix common issues:

bunpress seo:check --fix

This will:

  • Add missing meta descriptions (from content)
  • Fix heading hierarchy issues
  • Add missing alt text placeholders
  • Normalize title lengths

Structured Data

BunPress generates JSON-LD structured data for better search results:

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "TechArticle",
  "headline": "Page Title",
  "description": "Page description",
  "author": {
    "@type": "Organization",
    "name": "My Project"
  },
  "datePublished": "2024-01-01",
  "dateModified": "2024-06-15"
}
</script>

Best Practices

Title Optimization

---

title: Getting Started with BunPress | My Project Docs
---

Keep titles:

  • 50-60 characters
  • Include primary keywords
  • Unique per page

Description Optimization

---

description: Learn how to install and configure BunPress, the lightning-fast documentation generator, in under 5 minutes
---

Keep descriptions:

  • 150-160 characters
  • Include call-to-action
  • Unique per page

Heading Structure


# Main Page Title (only one h1)

## Section Heading

### Subsection

## Another Section

### Another Subsection

Image Optimization

![BunPress dashboard showing build performance metrics](/images/dashboard.png "BunPress Dashboard")
  • Always include descriptive alt text
  • Use meaningful file names
  • Compress images for fast loading

Internal Linking

Learn more about [configuration options](/guide/configuration) and
[markdown features](/guide/markdown-features).
  • Use descriptive anchor text
  • Link to related content
  • Avoid "click here" links