Skip to content

Repository files navigation

Eleventy-Plugin Backlinks

Collect and display backlinks from your notes.

NPM version badge

Note: I'm not building this project for myself, so y'all gotta tell me what you think. Issues are the way to go here.

Usage

Add the plugin to your eleventy config, like so:

import eleventyBacklinks from 'eleventy-plugin-backlinks';

export default function(eleventyConfig) {
	eleventyConfig.addPlugin(eleventyBacklinks, {
		folder: '/notes', // The folder with your notes
		getData(note) {
			return {
				url: note.url,
				title: note.data.title,
			};
		},
	});
}

Rendering

For every page in the given folder, you get a backlinks variable. By default, it contains an array, with the title (if set) and the url of each page.

<!-- includes/noteLayout.njk -->
<ul>
	{% for link in backlinks %}
	<li>
		<a href="{{ link.url }}">{{link.title}}</a>
	</li>
	{% endfor %}
</ul>

Options

  • folder (string) - The name of a folder which contains your notes. The default folder-name is "notes".
  • getData (function) - Optionally, control which data will be passed to backlinks. The function receives a collection item, and is called for every relevant page. You return an object, which is merged with the page's data cascade. Using this option replaces the default implementation.

Contributing

All input is welcome; feel free to open an issue. Please remember to be a mensch. If you want to program, you can browse the issue list.

Legal

All source-code is provided under the terms of the MIT license. Copyright 2026 Binyamin Aron Green.

About

An Eleventy plugin for mind gardens. Collect and display backlinks from your notes

Topics

Resources

Stars

18 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages