Questions tagged [eleventy]

Eleventy (11ty) is a static site generator. Use this tag for questions about the generator itself or about the usage of it.

Eleventy is a Node.js-based static site generator. It is template/framework-agnostic, works with multiple template languages, from Markdown to Liquid, or just JavaScript.

  • Good performance
  • Templating engine-independent
  • Framework-agnostic, no JavaScript runtime
  • Layout inheritance
  • Shortcodes
  • Custom 'filter' to modify content in multiple template engines
  • Generate pages from static JSON files

Find out more at 11ty.dev.


Resources

Competitors

261 questions
9
votes
4 answers

How do you specify a default layout for all pages in eleventy?

It seems like you should be able to specify a fallback layout for all pages in an 11ty site using global data files and the data cascade, but I can't figure out how. I've tried the following JSON in several locations: { "layout":…
darth_mall
  • 984
  • 8
  • 16
9
votes
3 answers

Eleventy (11ty) Data Pagination - Title from data

Trying to setup pagination with data, where {{ title }} in {{ title }} is the title of the current page as defined in projects.json Assumed this could be done: # main.njk {{ title }} #…
7
votes
2 answers

How to have relative paths in eleventy?

I am currently working on a 11ty project and really like it. But I have a problem with the links when I deploy the output. I'd like to deploy it to 2 different locations on separate servers. One of the locations is in the root directory, the other…
jost21
  • 1,084
  • 3
  • 15
  • 29
5
votes
1 answer

Can't @apply Tailwind state variant classes using Eleventy and Sass

Problem: I’m using 11ty with Tailwind and Sass. Whenever I use a Tailwind state variant class in a .scss file (eg. .class { @apply sm:flex }) it negates the entire CSS rule, including all other classes declared with it. I'd love to be able to @apply…
Ted Goas
  • 7,051
  • 1
  • 35
  • 42
5
votes
1 answer

Data from yaml files in 11ty / eleventy

On my 11ty site (skeleventy-starter) I want to parse hundreds of reviews. These reviews are stored in my data folder in a folder called reviews as individual yaml-files (named like this: "entry-7128372832.yml"). Each yaml file looks like this: _id:…
Jay
  • 88
  • 1
  • 1
  • 8
5
votes
1 answer

How to make eleventy include assets such as CSS and images in the output?

I'm trying out the eleventy static site generator for the first time. Whenever I build, the content files are generated just fine, but none of the assets (CSS, JS, images, etc.) end up in the output directory - all that appears is the HTML, with…
jcolton
  • 193
  • 7
4
votes
1 answer

Search functionality in 11ty

I am building a basic search functionality on an 11ty site based on this tutorial. My problem is when I type the form and submit it, it will take me to another site even though I included preventDefault() in the code. Did I miss out on the steps or…
Mohammed Asker
  • 97
  • 1
  • 1
  • 14
4
votes
1 answer

Several CSS files for 11ty with Nunjucks

So I have an 11ty site structured like this . └── app/ ├── public ├── src / │ ├── _includes/ │ │ ├── base.njk │ │ ├── header.njk │ │ └── footer.njk │ ├── css/ │ │ ├── about.css │ │ ├──…
Mohammed Asker
  • 97
  • 1
  • 1
  • 14
4
votes
1 answer

How to list tags for the current post - Eleventy js?

I am using Eleventy JS. And I can't list the tags for the current post. There is nothing written about this in the official documentation. All tags are listed easily. But for the current post I can not display the tags on the screen This code to…
4
votes
1 answer

How to import javascript modules and bundle into a single js file with rollup?

I have javascript functions I want to run both server-side and client side. The server side uses node.js and can handle imports just fine. However, the client side i want a single script tag with inlined javascript. To achieve that goal I understood…
Nathaniel
  • 394
  • 1
  • 6
  • 14
4
votes
1 answer

How do I use an excerpt from Eleventy's gray-matter?

Goal: Display a post excerpt for each post in the post list of an Eleventy blog I'm adapting this starter project as my own blog. I'm referring to this Eleventy document to get the post excerpt. My code: I started by editing my .eleventy.js to…
Eleanor Holley
  • 691
  • 1
  • 7
  • 27
4
votes
1 answer

Use variable and filter within tag in nunjucks + eleventy

I am a nunjucks newbie - trying it out along with eleventy. Short version: can I use variables and filters within tags in nunjucks? For example: {% set myVar = {{ title | lower }} %} (assume the {{ title }} variable is set correctly) Longer version…
3
votes
2 answers

Eleventy programmatic API - what should the input path look like?

I have a aws lambda function which calls the eleventy.write() or eleventy.toJSON() method but can't seem to make it work. I have tried different project structures and setting different paths but it either returns an empty array or it throws the…
3
votes
1 answer

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 | getPostsByContributor: contributor.key %} Eleventy…
rocco
  • 115
  • 1
  • 7
3
votes
1 answer

How to access the page front-matter data in 11ty from the code of a custom tag (shortcode)?

In Eleventy (11ty) the page source can define custom data in it's front-matter. E.g.: --- title: this is front-matter data --- Page content {% myCustomTag valueOfArg1 %} where the custom tag (also known as shortcode in Eleventy) is generating extra…
Gabriel Petrovay
  • 20,476
  • 22
  • 97
  • 168
1
2 3
17 18