All Questions
17 questions
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 ...
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
│ ...
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 ...
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 ...
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 }}...
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 ...
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: &...
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 ...
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 ...
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 | ...
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
...
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=&...
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', ...
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....
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 ...
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-...
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 ...