Backlinks and Related Files

Last updated:
2020-10-21 13:47

Purpose: This document explains how to render a list of backlinks or related files in your Firn layouts.

Prerequistes: an understanding of The Render Function and how layouts work.

Overview

Backlinks are used to display a list of links to the current document you are reading. A document has backlinks if an org-mode file links to another org-mode file using a "file" link.

Related Files are files that might be related because they share a tag with the file being rendered.

Generally, these render functions make exploring a large wiki-type site more easily navigatable. These render functions were largely inspired by org-roam, which Firn tries to integrate with on a basic level (see: firn tags).

Usage

(render :backlinks)
;; output =>
[:ul.firn-backlinks
 [:li.firn-backlink
  [:a {:href "/file1"} "Org Mode"]]]

(render :related-files)
;; output =>
[:ul.firn-related-files
 [:li.firn-related-file
  [:a.firn-related-file-link {:href "/file-small"} "Firn"]]]

The above will render a list of backlinks and related-files. If a file has neither backlinks or related files these functions will return nil.

Previous: Adjacent Files Next: Org Tags