Asian Americans Advancing Justice — Stand Against Hatred
The possum is Eleventy’s mascot
Eleventy Documentation
Eleventy 1.93s
Astro 22.90s

inputPathToUrl Universal Filter

Pre-release only: v3.0.0-alpha.5 Map a file’s location and to the template’s output URL. Very useful for robust hyperlinking allowing you to change your output URLs without breaking content links!

This filter is an alternative to the InputPath To Url Plugin, which provides an Eleventy transform that is less verbose but a bit slower.

Inspired by GitHub issue #84.

Usage Jump to heading

View this example in: Liquid Nunjucks 11ty.js Handlebars
Syntax Liquid
<a href="{{ "" | inputPathToUrl }}">Home</a>
Syntax Nunjucks
<a href="{{ "" | inputPathToUrl }}">Home</a>
Syntax JavaScript (CommonJS)
module.exports = function(data) {
return `<a href="${this.inputPathToUrl("")}">Home</a>`;
Syntax JavaScript (ESM)
export default function(data) {
return `<a href="${this.inputPathToUrl("")}">Home</a>`;
Syntax Handlebars
<a href="{{ inputPathToUrl "" }}">Home</a>

Renders as <a href="/">Home</a>.

← Back to Filters documentation.

Other pages in Filters: