Content Files
Non-Markdown files placed in the content/ directory can be automatically published to the output directory. This is useful for images, PDFs, and other assets that live alongside your content.
Configuration
Enable content file publishing in config.toml:
[content.files]
allow_extensions = ["jpg", "jpeg", "png", "gif", "svg", "webp", "pdf"]
disallow_extensions = ["psd", "ai"]
disallow_paths = ["drafts/**", "**/_*"]
| Key | Type | Default | Description |
|---|---|---|---|
| allow_extensions | array | [] | File extensions to publish. Publishing is on while this list is non-empty (extensions is accepted as an alias) |
| disallow_extensions | array | [] | File extensions to exclude |
| disallow_paths | array | [] | Glob patterns for paths to exclude |
How It Works
When content file publishing is enabled, Hwaro copies non-Markdown files from content/ to the output directory, preserving their directory structure.
Example
content/
├── about/
│ ├── index.md → /about/index.html
│ ├── team-photo.jpg → /about/team-photo.jpg
│ └── resume.pdf → /about/resume.pdf
├── blog/
│ ├── _index.md → /blog/index.html
│ └── my-post/
│ ├── index.md → /blog/my-post/index.html
│ ├── diagram.svg → /blog/my-post/diagram.svg
│ └── screenshot.png → /blog/my-post/screenshot.png
└── index.md → /index.html
Files are copied directly to the matching output path. The content/ prefix is stripped automatically.
Unpublished bundles
Files inside a page bundle whose page is not published are not copied either: a draft (unless you build with --drafts), a future-dated page (unless --include-future) or an expired page (unless --include-expired). In the example above, setting draft = true in blog/my-post/index.md also withholds diagram.svg and screenshot.png. A published bundle nested inside an unpublished one still publishes its own files.
JSON and XML files
.json and .xml files under content/ are published as raw files even without an allow_extensions entry (and minified with --minify). The deny rules below — disallow_extensions and disallow_paths — and the unpublished-bundle rule above still apply to them.
Output path conflicts
A content file never replaces a page or a generated file. When one would land on the same output path as a rendered page (content/about/index.html beside content/about.md), an alias redirect, the feed, the sitemap, robots.txt or another generated file, the generated output is kept and the build warns Not publishing content/…. Files in static/ follow the same rule.
When a raw file from content/ takes the place of an old output directory, a cached build publishes it at that path. If the directory contains a current output or an unrelated file, Hwaro keeps it and skips the raw file with a warning.
Extension Matching
Allow List
Only files with extensions in allow_extensions are published:
[content.files]
allow_extensions = ["jpg", "jpeg", "png", "gif", "svg", "webp"]
Extensions are normalized, so both "jpg" and ".jpg" are accepted, and matching ignores case (photo.JPG matches "jpg"). .md files are never copied this way.
Deny List
Exclude specific extensions with disallow_extensions:
[content.files]
allow_extensions = ["jpg", "png", "gif", "svg"]
disallow_extensions = ["psd", "ai", "sketch"]
The deny list takes priority over the allow list.
Path Exclusion
Exclude files by path pattern using glob syntax:
[content.files]
disallow_paths = ["drafts/**", "**/_*", "private/**"]
| Pattern | Matches |
|---|---|
drafts/** |
All files under content/drafts/ |
**/_* |
Any file starting with underscore |
private/** |
All files under content/private/ |
Paths are matched relative to the content/ directory. The deny rules (disallow_extensions and disallow_paths) also keep files out of page bundles, with or without allow_extensions.
disallow_paths only covers non-Markdown files. To keep a path out of the site entirely, Markdown included (a README.md, a _templates/ folder), use [content] ignore. It takes the same patterns, and an ignored file is never a page, a bundle asset or a published file.
Referencing Content Files
In Markdown
Reference colocated files with relative paths:

[Download Resume](resume.pdf)

A file the rules above leave out is not copied, so a link to it is dead. When a page bundle links or embeds such a file of its own ([Download](report.pdf) with pdf missing from allow_extensions), the build warns <page> links to report.pdf, which the build does not publish once per page and file. hwaro tool check-links reports the same links.
In Templates
For page bundles, colocated assets are also available via page.assets:
{% for asset in page.assets %}
{% if asset is matching("[.](jpg|png|gif)$") %}
<img src="{{ get_url(path=asset) }}" alt="Asset">
{% endif %}
{% endfor %}
Content Files vs Static Files
| Feature | Content Files (content/) |
Static Files (static/) |
|---|---|---|
| Colocated with content | ✅ Yes | ❌ No |
| Requires configuration | ✅ Yes | ❌ No (copied by default, cruft filtered) |
| Extension filtering | ✅ Yes | ❌ No |
| Path filtering | ✅ Yes (disallow_paths) |
✅ Yes ([static] exclude) |
| Best for | Per-page assets | Site-wide assets |
Use content files for assets that belong to specific pages (screenshots, diagrams, attachments). Use static files for site-wide assets (CSS, JS, logos, favicons). See [static] to exclude cruft or specific paths.
Tips
- Page Bundles: For the best organization, use page bundles and place
index.mdand its assets in a directory together. - Image formats: Include common web image formats:
["jpg", "jpeg", "png", "gif", "svg", "webp"]. - Security: Use
disallow_pathsto prevent publishing source files or drafts. - Keep it lean: Only allow extensions you actually need. This prevents accidentally publishing large source files.
See Also
- Image Processing — Automatic image resizing
- Pages — Asset Colocation — Page bundles
- Sections — Asset Colocation — Section assets
- Configuration — Full configuration reference