Content Mode Introduction

Learn what Content Mode is and why you'd want to use it to build content-driven static sites with Hammer.

What is Content Mode?

Content Mode is a powerful feature that transforms Hammer from a static site builder into a content-driven static site generator. It enables dynamic page generation from content files (Markdown and YAML), allowing you to create multiple pages from a single template.

With Content Mode, you can:

  • Separate content from presentation (content files vs templates)
  • Generate multiple pages from a single template
  • Manage content through files instead of editing HTML
  • Support content relationships (e.g., posts → authors)
  • Control publishing with built-in draft/publish/scheduled states

Content Mode is similar to workflows used in Jekyll, Eleventy, or Decap CMS, bringing the power of content-driven development to Hammer.

Why Use Content Mode?

Content Mode offers several key advantages for building modern static sites:

Separation of Concerns

Content Mode separates your content from your presentation layer. Content lives in Markdown or YAML files, while templates handle how that content is displayed. This makes it easier to:

  • Update content without touching HTML
  • Change design without affecting content
  • Collaborate with content creators who may not know HTML
  • Maintain consistency across your site

Dynamic Page Generation

Instead of creating individual HTML files for each page, you create one template that generates multiple pages. This means:

  • Less repetitive code
  • Easier maintenance
  • Consistent design across all pages
  • Faster development workflow

Content Relationships

Content Mode supports relationships between content items. For example, you can link blog posts to authors, products to categories, or pages to related content. These relationships are automatically resolved in your templates.

Publishing Controls

Built-in publishing controls let you manage content visibility:

  • Published: Content is live and visible
  • Draft: Content is excluded from builds
  • Scheduled: Content publishes automatically on a future date

When to Use Content Mode

Content Mode is ideal for:

Blogs

Perfect for blogs where you have many posts with the same structure. Create one template, add Markdown files for each post, and Hammer generates all the pages automatically.

Documentation Sites

Great for documentation where pages share a common structure. Write content in Markdown, and let templates handle the presentation consistently.

Portfolios

Ideal for portfolios where projects or case studies follow the same format. Manage project data in YAML files and display them with a single template.

Content-Heavy Sites

Any site with repeating content structures benefits from Content Mode. If you find yourself copying and pasting HTML with minor changes, Content Mode can simplify your workflow.

Tip: If you have repeating content structures or need to manage many similar pages, Content Mode will save you time and make your site easier to maintain.

Key Concepts

Before diving in, here are the core concepts you'll work with in Content Mode:

Collections

Groups of related content files. For example, a "posts" collection contains all your blog posts, or an "authors" collection contains author profiles.

Content Files

Markdown (.md) or YAML (.yaml) files that contain your content. Markdown files have front matter (metadata) and body content, while YAML files are pure data.

Templates

HTML files with Hammer template tags that define how content is rendered. One template can generate multiple pages, one for each content file in a collection.

Configuration

The content.config.json file defines your collections, templates, output paths, and field structures. This is where you configure how Content Mode works for your site.

Next Steps

Now that you understand what Content Mode is, learn how to get started: