Attachments
On this page
Page bundles and sections can include attachments. Snow reads these from content/ and copies them alongside the page or section output.
Page Bundle Attachments
A directory containing index.{md,org,html} is a page bundle. Other files can be attachments:
content/ └── posts/ └── hello/ ├── index.md ├── image.png └── gallery/ └── cover.png
Without an assets list, Snow collects all attachments in the bundle. A nonempty list limits collection to matching files:
--- title: "Hello" assets: - image.png - gallery/**/*.png ---
Patterns support recursive glob matching with doublestar.
Section Attachments
Declare attachments in the section's index front matter:
--- title: "Blog" assets: - cover.png - media/**/*.png ---
Sections do not collect files automatically. Only files matching assets are copied.
Source Paths
Paths must be relative to the page bundle or section directory. Absolute paths, a leading ./, and parent-directory traversal are not allowed.
Valid:
assets: - image.png - media/cover.png - gallery/**/*.jpg
Invalid:
assets: - /image.png - ./image.png - ../image.png - media/../image.png
Output Locations
Attachments follow the final Page or Section Path. A directory path ending in / puts attachments inside that directory:
| Source | Output Path | Attachment | Attachment URL |
|---|---|---|---|
posts/hello/index.md |
/posts/hello/ |
image.png |
/posts/hello/image.png |
posts/hello/index.md |
/posts/hello/ |
gallery/cover.png |
/posts/hello/gallery/cover.png |
A file output path puts attachments in the file's containing directory:
| Source | Output Path | Attachment | Attachment URL |
|---|---|---|---|
posts/hello/index.md |
/posts/hello.html |
image.png |
/posts/image.png |
posts/hello/index.md |
/posts/hello.html |
gallery/cover.png |
/posts/gallery/cover.png |
blog/_index.md |
/blog.html |
cover.png |
/cover.png |
blog/_index.md |
/blog.html |
media/cover.png |
/media/cover.png |
Attachment subdirectories are preserved.
Template Variables
Attachments are available as page.Assets or section.Assets:
| Field | Description |
|---|---|
File |
Source file information |
Path |
Relative output URL |
Permalink |
Absolute output URL |
{% for asset in page.Assets %} <a href="{{ asset.Permalink }}">{{ asset.File.Name }}</a> {% endfor %}