Blot

Folder posts

A folder post is a folder whose name ends in +. Blot converts every file inside, concatenates the results in alphabetical order and publishes them as one entry at the folder’s path without the + (for example /Album + is published at /album). This guide covers the HTML Blot generates so you can build a slideshow, gallery or other custom layout in your template.

Generated markup

The combined content is wrapped in a single <section class="multi-file-post">. Each source file is rendered inside its own <section class="multi-file-entry">, in the order the files appear on your site.

<section class="multi-file-post" data-folder="/Album +">
  <section class="multi-file-entry" data-file="/Album +/01-intro.md" data-index="0" data-extension="md">
    <h1>Intro</h1>
    <p>…</p>
  </section>
  <section class="multi-file-entry" data-file="/Album +/02-first.jpg" data-index="1" data-extension="jpg">
    <img src="/Album +/02-first.jpg">
  </section>
</section>

Attributes

AttributeWhereValue
data-folder.multi-file-postPath to the + folder.
data-file.multi-file-entryPath to the source file for that section.
data-index.multi-file-entryZero-based position of the file in the post.
data-extension.multi-file-entryLower-cased file extension, e.g. md, jpg. Omitted when the file has no extension.

The injected title

If none of the first three source sections produces an <h1>, Blot inserts one as the first child of .multi-file-post so the post is never headingless:

<h1 class="multi-file-title">Album</h1>

The text is an explicit Title from the merged metadata, or the folder name with the trailing + removed and any percent-encoding decoded. Blot only checks the first three sections because that is as far as it looks when deriving the entry title — if the first heading appears in a later file you will see both it and the generated .multi-file-title, so target .multi-file-title in CSS if you want to hide or restyle it.

Merged metadata, dependencies and stats

Metadata from every source file is merged into the entry. Later files override earlier files for a repeated key (matched case-insensitively), except Tags, which are unioned across all files. Dependencies (such as images referenced by a Markdown file) and the entry’s size and dates are merged the same way. The list of source files is not exposed to templates as metadata — read it from the data-file attributes in entry.html if you need it.

Limits

  • Blot walks subfolders of the + folder. A folder post is capped at 50 convertible files; above that Blot does not build the post.
  • Files Blot cannot convert, and ignored files (names starting with _, files inside _ folders), are skipped.
  • If a file’s converter is disabled for the site (for example image posts), that file is left out of the aggregate.

Example: a slideshow

Each .multi-file-entry becomes a slide. This example uses only CSS scroll-snapping, so it works without JavaScript; add controls as needed.

{{#entry}}
  {{{entry.html}}}
{{/entry}}
.multi-file-post {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 1rem;
}

.multi-file-post .multi-file-entry {
  flex: 0 0 100%;
  scroll-snap-align: center;
}

/* Hide the auto-generated title if you render your own */
.multi-file-post .multi-file-title {
  position: absolute;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
}

Because entry.html already contains the wrapper, you do not iterate the files in Mustache — render {{{entry.html}}} and style the sections. To treat only folder posts differently, test for the multi-file-post wrapper class (or a data-folder attribute) in entry.html.

Example: styling by file type

.multi-file-entry[data-extension="jpg"],
.multi-file-entry[data-extension="png"] {
  margin: 0;
}

.multi-file-entry[data-extension="md"] {
  max-width: 40rem;
  margin: 0 auto;
}
Implementation reference
  1. Aggregation, file collection and the 50-file cap: app/build/multiple.js.
  2. Wrapper markup and injected title: renderHtmlSections / deriveHeading in app/build/multiple.js.
  3. Resolving a + folder to its published path: findMultiFolder in app/build/index.js.
  4. User-facing overview: app/views/how/sub-folders/folder-posts.html.