279 questions
1
vote
0
answers
39
views
Why are template strings in 11ty not rendering values from JSON content files?
I'm using 11ty to build a simple static site and have structured my project into templates and content directories. The template strings in my Nunjuck .njk templates are not rendering values from ...
0
votes
1
answer
45
views
How to display image from Strapi collection content
Im having trouble receiving the media attribute of my content in my collection from strapi on my 11ty project. Every time I try something with trying to recieve my image data it breaks my page.
Strapi ...
0
votes
1
answer
23
views
How do I reference data in front-matter?
I have a base.njk layout that sets the title based on frontmatter:
---
title: My Site
---
<html>
<head>
<title>{{ title }}</title>
</head>
<body>
{{ ...
0
votes
1
answer
33
views
How do I handle 429 errors from eleventy-fetch?
I'm making a request with eleventy-fetch like this:
let response = await EleventyFetch(url, {
duration: "1h",
type: "json"
});
However, sometimes it fails with an error:
...
0
votes
0
answers
17
views
Set Asset Path for .webc files in Eleventy
In a .webc file, I have something like this
<script src="/js/common.js"></script>
and when running eleventy build, the file path is considered as src/_components/js/common.js. ...
0
votes
0
answers
40
views
How can I add a 'cover image' to collection items in the admin panel?
Using Decap CMS (formerly Netlify CMS) -- In the admin dashboard, how can I add a cover image/thumbnail to a collection item using the _data directory? On the demo site from their documentation:
https:...
2
votes
1
answer
93
views
Process eleventy shortcodes in markdown-rendered FrontMatter data
I'm using 11ty with Decap CMS for a client webiste.
I have several front-matter fields to add markdown content (I need to add Markdown content to boxes in several locations) .
I render the markdown ...
0
votes
1
answer
32
views
in eleventy, how do I modify the response header, In the response header I want to add Strict-Transport-Security: max-age=31536000; includeSubDomain;
These is the response header I would want to put some HSTS/ Stric-Transport-Security: max-age=31536000; includeSubDomains; preload, I already done using a way that I will add _header in the root ...
1
vote
0
answers
32
views
Getting node-pandoc to return filename with error
I replaced the default markdown processor in Eleventy 2.0.1 with node-pandoc like thus:
const nodePandoc = require('node-pandoc');
module.exports = function(eleventyConfig) {
async function ...
0
votes
0
answers
18
views
Is it possible for a user of CloudCannon to change easily global colors of my site?
I'm beginner in Eleventy, CloudCannon and not very good in english. Sorry for my mistakes.
I have an eleventy static site
with global css values in my css file in :root
I installed the site in ...
0
votes
0
answers
118
views
Accessing the collections object and json data from a JavaScript file with Eleventy
I'm a very beginner in eleventy. And also in English!
I'm studying alone. I have a html page gallery.html with a dropdown menu. I have a javascript file that will add some html content dynamically ...
1
vote
1
answer
77
views
Display HTML front matter in a layout using Eleventy
I'm using Eleventy to generate pages for a blog. I have some HTML content in the front matter of my posts, but I cannot get it to display as HTML. When I reference it in my template, it's converted to ...
0
votes
0
answers
216
views
Eleventy - Unable to find images on build
I am building a static blog using eleventy. I have my layouts set up but I'm having trouble getting the images to display. I'm using 11ty 3.0.0-alpha.10 with @11ty/eleventy-img version 4.0.2. I'm ...
0
votes
0
answers
16
views
Different conversion functions per file path in Eleventy?
I replaced the default Markdown-It library with node-pandoc in my instance of Eleventy, as per the code below. Now, I would like to apply different arguments to the nodePandoc function according to ...
1
vote
1
answer
273
views
Stackblitz "Failed to run start command"
Today I wanted to continue working on my Github reposiroty via Stackblitz and ran into some issues. For some reason I'm not able to start the terminal process to start the live server. I need it to ...
1
vote
0
answers
136
views
Eleventy not updating changes from src folder to public folder
I just started working with Eleventy and everything was working fine till I came to the point where my public folder is not getting updated when I make changes in the src folder.
This is my code so ...
1
vote
0
answers
82
views
created template for blog article doesn't take css file
Currently I'm working on a project to create my first blog website. Therefore I created my website with HTML and CSS and implemented everything with Eleventy so I can put my webpage into a CMS for ...
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
0
answers
31
views
Client-side site search using combobox, most performant way to get the indexed results
I'm implementing a site search in a site I have built. The site uses the JAM stack (11ty & Netlify) and I'm unsure which strategy to use for grabbing the query data.
It's a basic combobox pattern, ...
0
votes
0
answers
69
views
Eleventy/11ty paginate content in pages generated from global data
I have a big global data JSON of images (ìmages.json) to build an image gallery with a structure like this (It's exported from a DB table):
[
{
"category_id": "4",
"...
0
votes
1
answer
130
views
Nunjucks and an Eleventy shortcode aren't connecting to each other
I've written an Eleventy shortcode to take the filename of an image (as well as text for an alt tag, etc), and output a whole srcset so it becomes a responsive image.
The site's written using Nunjucks,...
0
votes
1
answer
239
views
TemplateLayoutPathResolver directory does not exist for component: _includes
i am getting this error when i use eleventy in a workspace wiuthin a monorepo
The error is:
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] TemplateLayoutPathResolver ...
1
vote
0
answers
67
views
Adding Google for Jobs in Eleventy website
I want to add Google for Jobs to my eleventy (11ty) website. I am using Google Jobposting schema for reference and added the code to json file.
json file:
{
"layout": "jobpost.njk&...
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
0
answers
38
views
duplicate/clone and altering content in 11ty
I have a standard group of Eleventy posts (markdown files in a folder) which build to the standard site.com/slug/index.html path. I would also like to generate an additional meta file for each of ...
0
votes
0
answers
142
views
11ty Site Working Locally, but Missing CSS and Bootstrap on GitHub Pages After Repository Restructure
I have installed my 11ty, and all files are in the correct location (i think); when testing the page using the local server, the site is working well. However, the issue occurs when I push changes to ...
1
vote
1
answer
388
views
How to make Eleventy correctly build SCSS while in --serve mode?
I have a simple Eleventy project that uses SCSS.
My file structure is like this:
src
├─ styles
│ ├─ components
│ │ ├─ _buttons.scss
│ │ ├─ _forms.scss
│ ├─ site.scss
When I run the --serve CLI ...
-1
votes
1
answer
188
views
How to exclude files or folder from eleventy?
I am brand new to Eleventy, and generally everything is going smoothly. I have a simple Eleventy project that uses SCSS for my styles. I have a single styles/site.scss file which imports various ...
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
59
views
Specify default permalink in Eleventy?
I am using Eleventy to build a simple site, where all pages so far share the same layout. I am trying to minimise the amount of repetition in the front matter of each page template. The default with ...
0
votes
1
answer
79
views
how can i use nunjucks to only show posts from the previous 30 days in eleventy?
i have an eleventy project where i want to display posts, using nunjucks, from a particular collection from the previous 30-days (including the current date).
i found this post but i couldn't get it ...
0
votes
1
answer
374
views
Eleventy permalink output conflict when more than 2 pages added to collection
I'm having the strangest issue with permalinks and could use some help.
Windows 11
Eleventy 2.0.1
Nunjucks engine
Repo: https://github.com/wcDogg/eleventy-test
npm run build - No errors
Move test-c....
2
votes
1
answer
134
views
Eleventy tags - convert to lowercase and sort alphabetically?
I am using the tag filters from eleventy-base-blog:
eleventyConfig.addFilter("getAllTags", collection => {
let tagSet = new Set();
for(let item of collection) {
(item.data.tags || ...
0
votes
1
answer
203
views
Eleventy Nunjucks extend template block renders empty space
Hello :) I've set up a basic @11ty project. My templates are .html and my template engines are njk.
While {% include %} for partials and {% extend %} for layouts works as expected, I cannot get {% ...
0
votes
1
answer
75
views
How to remove the / at the end of my url with 11ty
I'm using vite, 11ty and pug to create a website and I'd like to have no / at the end of my url. I tried to do it for example with About page but it didn't work.
---
permalink: |
| "/About"...
0
votes
1
answer
152
views
Use value of variable in set statement in nunjucks macro
The following code works when I use collections.pages in the set statement of this nunjucks macro. collection_name is/prints collections.pages. How do I use the value of collection_name in the last ...
0
votes
1
answer
225
views
Eleventy : collection filtered by a custom tag (Cannot read properties of undefined (reading 'length'))
I'm new to eleventy and js in general, sorry, I feel that my question is a quite simple one but I'm not finding anything in the documentation, and the error is too general for me.
I have notes in a ...
0
votes
1
answer
276
views
Using 11ty and customizing tailwind for markdown and nunjuck files
I am attempting to create a website using 11ty and tailwind. I am using markdown and nunjuck files for this project and not html files. I am able to use tailwind with the classes that are shown in the ...
1
vote
1
answer
579
views
How to access json data file information from include file in 11ty / eleventy?
I need help with Eleventy (11ty), the static website generator.
In the default _data/ directory I have the following navigation.json file:
[
{
"name":"Home",
"url&...
0
votes
1
answer
135
views
Can't use sass indent syntax on 11ty
I am completely new to 11ty and I am trying to add sass to the project I have created. I have followed a tutorial and my project structure is as follows:
src
assets
styles
sass
< folders with ...
1
vote
0
answers
340
views
Eleventy (11ty) + Vite, inserts import into js file, but does not generate the imported file
I'm using 11ty with the eleventy-plugin-vite plugin to use Vite in post processing. However, when generating the production build, a script tag is inserted into the .html files with an src attribute ...
0
votes
1
answer
208
views
How do I limit a custom collection in 11ty to just posts, using `return collection.getAllSorted()`?
I have a custom collection in 11ty:
eleventyConfig.addCollection("recentPosts", function(collection) {
return collection.getAllSorted().reverse().slice(0, 3);
});
That code is from here:...
1
vote
0
answers
244
views
11ty images not generating on Netlify, working ok locally
I have a small 11ty site running on Netlify and using Decap CMS (formerly Netlify CMS). There's an image field for uploading JPGs, and I've used 11ty Image to generate a Webp and an AVIF, then create ...
0
votes
1
answer
63
views
Intermittent EMFILE, ENOTDIR, ENOENT errors during generation
I'm running npx eleventy in a docker container without changes to the source and see intermittant errors.
I see these errors every now and then:
EMFILE: too many open files
ENOTDIR: not a directory
...
0
votes
1
answer
272
views
Bootstrap 5 navbar logo overlap and toggle bar items alignment
I am working on 11ty+bootstrap template and trying to make some changes. I cloned the template from Github link and currently working in localhost.
The navbar has a normal text logo with background ...
0
votes
1
answer
320
views
Eleventy CLI Fatal Error error: sanityClient is not a function in config file '.eleventy.js
I am trying to link eleventy with sanityClient but getting this error.
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] 1. Error in your Eleventy config file '.eleventy.js'. (via ...
0
votes
1
answer
160
views
Failing to build eleventy blog
I am trying to create a personal blog. My directory structure looks like the following:
My .eleventy.js looks like the following:
module.exports = function (eleventyConfig) {
eleventyConfig....
0
votes
1
answer
150
views
use alpine JS/11ty/nunchucks to only display two dated items
I have a series of dated events in a json file. I want to display only two events that are happening the soonest relative to today's date. I'm using 11ty and nunchucks and have the following code:
<...
1
vote
1
answer
737
views
How to filter collections using a custom nunjucks filter in an eleventy template?
I'm new to both e11y and nunjucks and I'm having a hard time figuring it out.
I need to filter a collection to keep only items matching a condition. The selectattr filter would be perfect, but in ...