Adjacent Files

Last updated:
2020-09-25 19:06

Purpose: This document explains how to render links to "adjacent files" based on the #+FIRN_ORDER frontmatter.

Prerequistes: an understanding of The Render Function, layouts, front matter.


In some cases, you may wish to indicate what the "next" and "previous" page may be on your Firn site (such as linking to a previous blog post) - adjacent files accomplish this.

Constructing "adjacent files" requires your files to be using either the#+FIRN_ORDER (for sorting based on a numeric order) or the #+DATE_CREATED (for sorting based on date) front matter.

#+TITLE: My File

Please note that if there are gaps in your #+FIRN_ORDER values across files, adjacent files will not work.


; render a list of the previous and next file.
; this determines the Next/Previous file based on FIRN_ORDER
(render :adjacent-files)

; Renders Next/Previous file based on date created.
(render :adjacent-files {:sort-by :date})

; Changes the html output for "previous" and "next" text:
(render :adjacent-files {:next-text "Newer post: "
                         :prev-text "Older post: "})