Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
211 views

Make JavaScript function available for Nunjucks templates

How can I provide JavaScript functions for my Nunjucks templates when building websites with Eleventy? Let's suppose I have a Nunjucks layout file my_layout.njk in the folder _includes: <!doctype ...
Martin Hinze's user avatar
0 votes
1 answer
131 views

How to sort global data in a template loop with Eleventy?

I have created an Eleventy site with liquid templates and I have a folder full of individual .json files like this ├─ src │ ├─ _data │ │ ├─ site.json │ │ ├─ books │ │ | ├─ my-first-book.json │ ...
Chris Barr's user avatar
  • 33.8k
0 votes
1 answer
187 views

How to get an absolute URL with the slugify filter in Eleventy Liquid templates?

In an Eleventy site using Liquid templates I can usually get a full/absolute URL with the url filter like this {{'/books/' | url}} When I am looping through data I need to use the slugify filter to ...
Chris Barr's user avatar
  • 33.8k
0 votes
1 answer
197 views

How can I iterate over an array of front matter data in Eleventy?

I am building a static website using HTML templates and eleventy. I have some front matter data e.g. the page's title. That data also includes an array of items I want to display. The official ...
David Brossard's user avatar
0 votes
1 answer
82 views

Liquid - how to view all data in an object?

I am iterating around an object in Liquid for an Eleventy website, how can I see the full contents of that object? for example {%- for post in collections.posts -%} <li>{{ post.data.date }}...
atreeon's user avatar
  • 24k
0 votes
1 answer
227 views

Using front matter data in Liquid tags

I have a project in eleventy using Liquid for templates. It includes an image gallery which uses the official plugin for responsive images, invoked through a shortcode for generating the image markup ...
latinsniper's user avatar
1 vote
1 answer
525 views

Eleventy nested pages from data

I'm new to Eleventy and trying to create what seems like a straightforward site structure but I'm struggling so would appreciate any help. I have the following data: { authors: [ { name: &...
user7409110's user avatar
4 votes
1 answer
1k views

What is the proper way to include partial in liquid templates in eleventy 1?

Given the following file structure: root/ src/ _includes/ partials/ navbar.liquid footer.liquid address.liquid base.liquid index.liquid How do I include ...
mike's user avatar
  • 1,876
0 votes
1 answer
145 views

Trying to use a front matter element in a liquid {% for %} loop

I have the following front matter in an html file: --- layout: default title: Fausto Bellino Tasca | Montecito permalink: "/montecito.html" imageSet: "montecito" --- In the body ...
Bob Monsour's user avatar
3 votes
1 answer
597 views

change liquid syntax into nunjucks - is this correct?

I need to change this liquid syntax into nunjucks: {% assign posts = collections.post | getPostsByContributor: contributor.key %} Is this correct for nunjucks? {% set posts = collections.post | ...
rocco's user avatar
  • 125
0 votes
2 answers
765 views

How can I loop through a YAML collection with child collection in Lquid or Javascript in eleventy?

How do I take a YAML list with nested lists and output the nested items? --- - fruit - banana - apple - orange - vegetable - lettuce - broccoli - carrots - bread - cheese - meat - beef ...
mike's user avatar
  • 1,876
0 votes
0 answers
178 views

I need to iterate through an Eleventy collecting using a Pug template

I had a working template in nunjucks that I need to convert to pug, but Eleventy is having trouble reading the template. <ul> {% for email in collections.emails %} <li><a href=&...
Aaron Benjamin's user avatar
0 votes
1 answer
270 views

Eleventy + Liquid object in PairShortcodes

I am using liquid and eleventy — I want to pass an object to my shortcode, but I am getting an error. With nunjunks you could do something like... // .eleventy.js config.addPairedShortcode('alert', ...
Jamie's user avatar
  • 2,071
3 votes
1 answer
584 views

How can I exclude drafts from showing up in collections? Liquid/Eleventy

I'm building a website with Eleventy for the first time, and even though I have worked with Liquid for a while now, I just can't crack this one. I want to simplify the architecture as much as possible....
Anneke's user avatar
  • 31
3 votes
1 answer
837 views

Why is eleventy trying to parse a file in a passthrough copy?

I added a "scripts" folder as a passthrough copy to my Eleventy site and installed some npm dependencies inside it for scripts to be run on the page load. So my .eleventy.js has some lines ...
Eleanor Holley's user avatar
2 votes
0 answers
141 views

Eleventy, LiquidJS, and redefining the Markdown library

I have an Eleventy site where I've redefined the markdown library in order to enable footnotes. let markdownIt = require("markdown-it"); let markdownItFootnote = require("markdown-it-...
jshwlkr's user avatar
  • 355
1 vote
1 answer
1k views

Is it possible to have parent and child collections with Eleventy (11ty)?

I'd like to be able to have parent and child collections using Eleventy, which I can then loop through to create navigation. I currently have some posts with in a collection called continents, with ...
abbas_arezoo's user avatar
  • 1,068