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.
185
questions
0
votes
0
answers
7
views
Can I render a Nunjucks Template inside an 11ty shortcode?
I have a Nunjucks shortcode in an Eleventy project. It's added to configuration in eleventy.js with the Eleventy addNunjucksAsyncShortcode method. My shortcode has gotten extremely messy with complex ...
1
vote
1
answer
14
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
0
answers
32
views
Eleventy with git submodule for private content?
I'm trying to use Eleventy and Netlify to create a website with both public and private content, with the latter requiring authentication as in the 11ty/demo-eleventy-serverless-auth sample project. I'...
0
votes
2
answers
28
views
How to create a Tags collection and a Categories collection in Eleventy
I have the following two blocks of code in my .eleventy.js file
// Tags
eleventyConfig.addCollection('tagList', collection => {
const tagsSet = new Set();
collection.getAll()...
0
votes
0
answers
15
views
Eleventy website images disappear when deployed to Vercel
I have a /src folder and Eleventy serves up the images into /_site folder.
On my localhost I'm using the image route: static/img/imagename.png and it works when loading onto the localhost.
However the ...
0
votes
1
answer
20
views
Headless Eleventy 11ty not generating post files, only index
I'm trying to move away from .md files to a headless CMS.
I'm following this tutorial and for some reason, I see the posts data being created on the index file (blog/index.html) with the lists of ...
1
vote
3
answers
40
views
Check if page creation date is within the last 7 days with Eleventy and Nunjucks?
I posted a few days ago about having a way to check for newly created posts, and I am making some headway in this but got a little stuck as shortcodes are still a bit new to me. This is the shortcodes ...
0
votes
1
answer
35
views
Problem linking a JS file to a HTML file using Eleventy/11ty? Currently getting 'GET net::ERR_ABORTED 404 (Not Found)'
I'm creating a site using an SSG (11ty) and I'm having issues adding an external js file to my html. I've tried placing my tag in a few different places within my html, but I receive the below error ...
0
votes
1
answer
18
views
Why is Eleventy looking for templates in my /history folder?
For some reason Eleventy is looking for templates in my /history folder, which I have already made changes to. Is there a way to stop this?
Now when I run my build the following error occurs:
[11ty] 2....
0
votes
1
answer
25
views
Eleventy: Add pagination only to blog posts
In Eleventy, I have a simple layout file that I'd like to use for most pages on my website, including the blog collection. I'd like the layout to only add my pagination partial when in a blog post.
My ...
0
votes
1
answer
62
views
How can I get the full path to image src for eleventy-img if I use glob collections?
Problem:
I'm using the shortcode in /technical-seo/using-science-philosophy-organize-semantic-web.md {% image "grocery-isle.jpg", "Google Photos – Aisle 5, Faversham Sainsbury’s", &...
0
votes
1
answer
28
views
Push data from API to existing page (combining data sources) in Eleventy
I am trying to take an external URL added into a page's front matter --> send URL to scraper --> have scraper take metadata attributes --> push metadata attributes back to page's front matter....
0
votes
1
answer
30
views
Nunjucks variable
I'm using 11ty to render meta tags on different pages. I have a JSON where I have all the data defined.
{
"home": [
[
{
"paramType": "content",
...
0
votes
0
answers
24
views
Eleventy returning error "Error: Node does not exist: undefined"?
Trying to hide a page (which is the only page in a folder) with eleventyNavigation as when I use eleventyExcludeFromCollections: true I get the error:
Error: Node does not exist: undefined
The folder ...
1
vote
1
answer
40
views
11ty pagation across multiple directories / multiple pagation
Im using Eleventy/11ty site generator and I have a myData object structured like this
[ {name: one, data: [1,2,3]},
{name: two, data: [1,2,3,4]} ]
And I want to generate a set of paged directories ...
0
votes
1
answer
25
views
How to directly fetch permalink data (URL) from font-matter in 11ty?
I need some help with changing the URL/ permalink of my blog posts in 11ty. Currently, it's making the slug with the title of the post. However, I want it to make a slug that I want. For example: for ...
0
votes
1
answer
73
views
How to set Eleventy URL paths that differ from their file paths
I'm building an Eleventy site and am generating blog posts from my markdown files. Unfortunately I am unable to set URL paths for these blog posts such that they differ from their file path structure. ...
1
vote
1
answer
69
views
using frontmatter as data in 11ty
I need some help setting a featured image frontmatter parameter. I've been trying for hours to get this working and can't seem to figure it out.
---
title: My post
date: 2020-02-23
published: true
...
1
vote
1
answer
105
views
Iterate over global data subfolder in Eleventy / 11ty
I'm using Eleventy and have created the subfolder yummy in my global data folder, that contains the following files:
\src\_data\yummy\drinks.json
\src\_data\yummy\food.json
When I use {{ yummy | dump ...
0
votes
1
answer
68
views
Eleventy - How to compile .yaml files (text not data) into html?
I'm new using Eleventy, but I succeed in turning .md files into .html.
So far so good, even using templates/layouts.
However, I've a problem I can't solve.
Consider a bunch of yaml files (they are not ...
1
vote
1
answer
126
views
11ty - How do I display post / page year?
I'm using Eleventy and using Posts. I have set the date in the meta data using the format
date: 2021-09-10.
I can display the full date using
{{ page.date | readableDate }}
But I want to display just ...
0
votes
2
answers
89
views
How test 11ty 404 page?
I've build a 404 page for my 11ty project, as shown in the 11ty quick tips:
https://www.11ty.dev/docs/quicktips/not-found/
QUICK TIP #006—ADDING A 404 NOT FOUND PAGE TO YOUR STATIC SITE
I then added ...
0
votes
1
answer
82
views
Render Nunjucks macro in AJAX call on client side?
I am trying to render data from a JSON file on the front end using AJAX (I am also using Eleventy, Nunjucks, and jQuery), and it would save a lot of headache + time to be able to use a Nunjucks macro (...
0
votes
1
answer
35
views
NEAT Stack starter is behaving strangely
I cloned and installed the NEAT stack starter. When I go on mobile mode with the devtools and try to click the burger menu in the top nav, it showed both the burger icon and the "X" ...
0
votes
1
answer
35
views
How do I generate Eleventy and display tags from a localized version of a collection file?
I'm new to Eleventy and working on a personal project - most of it is working fine, but I need help with generating and filtering tags based on posts stored in separate folders (as part of ...
0
votes
1
answer
42
views
How to get page title in config file in Eleventy JS?
I need to insert the title of the page in the ALT attribute. How to get the title? The code below is located in the .eleventy.js file
Right now I get the title if I pass in the props "title"....
0
votes
2
answers
124
views
11ty multiple data sources for one template
I'm using 11ty to build static web pages.
I am creating data sources as json files and storing them in the globally accessible _data directory.
template.njk
{% for key, value in data %}
<div&...
0
votes
1
answer
84
views
dynamic classes with tailwindcss and eleventy
I am using eleventy.js with tailwindcss and postcss. In my setup, postcss does not seem to recognise dynamic classes like
md:pl-{{(loop.length-loop.index+1)*2}}
And so I never get them in the final ...
3
votes
1
answer
93
views
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 ...
0
votes
1
answer
43
views
How to use a method multiple times in one?
Objective:
So I'm using Eleventy as an SSG and want to create multiple folders and copy some files into these folders, before Eleventy is doing the building or site generation.
A JSON file is for the ...
1
vote
0
answers
111
views
eleventy collections api - add collections dynamically
I want to create collections dynamically in 11ty.js and for that i have a block of code like so
eleventyConfig.addCollection("myGithub", (collection) => {
const result = collection....
0
votes
1
answer
99
views
Running eleventy build (via npm run) as AWS Lambda function
I have a eleventy Node project, which renders HTML from a JSON file.
Currently, I run this locally using npm run (which runs the eleventy CLI)
Here's the workflow I have in my head:
put the JSON file ...
1
vote
2
answers
63
views
text tag not rendering inside a link tag
I want to use text tags inside svg as links but wrapping them inside an a tag seems to make them unable to render. here is the html
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:...
0
votes
1
answer
40
views
Using 11ty as CMS for backend system
Not 100% sure if this is possible but the goal is to have a single point of entry (naked domain https://example.com) for entire system
Backend/application (load balanced) is using either LEMP/Rails/...
0
votes
0
answers
21
views
11ty integration with Ghost won't generate output files
I'm trying to retrieve the Ghost blog post and integrate them on my 11ty structure.
However, when trying to do so, 11ty won't generate the HTML file for the post I retrieve from Ghost. I can see by ...
0
votes
1
answer
123
views
Hide invalid dates in luxon
I'm trying to format an HTML layout to not show my date elements if they are invalid. I have a "Created" date and an "Updated" date, so at the very least one field will be empty ...
1
vote
1
answer
96
views
Maintaining external links in Eleventy
I'm using markdown reference links in my eleventy site.
Rather than repeatedly defining links on each page, I'd rather put them in one place, and just reference them in my pages.
For example links.md ...
0
votes
0
answers
29
views
11ty Nested Async Nunjucks Shortcodes?
I've got some nested paired shortcodes. The inner content isn't rendering.
{% renderSlots for=package %}
{% renderSlots for="pfe-collapse-toggle",
level=3,
...
0
votes
0
answers
194
views
Can I convert a front matter string/list to array with nunjucks?
I'm using Eleventy and NetlifyCMS and I want one field that is a string (sepparated by comma) to convert to an array in JSON so I can search individual items in that field from Fuse.js
So I wrote a ....
0
votes
1
answer
78
views
Pagination doesn't work with extendable layouts in 11ty ( eleventy )
Describe the bug
When I extend nunjuck layout, pagination doesn't work
To Reproduce
{% extends "layouts/default.njk" %}
---
pagination:
data: categories
size: 1
alias: category
...
0
votes
0
answers
56
views
What's the correct way to add front matter data in 11ty?
I am following the documentation to add frontmatter data to an html-turned into .njk file and when I save the file, the metadata gets parsed and it gets rearranged in this format :
-- -title : My page ...
0
votes
1
answer
188
views
RSS feed undefined item element validation error
When I try to validate my RSS feed, It is giving me the below errors:
line 6, column 0: Undefined channel element: id
line 11, column 124: XML parsing error: :11:124: not
well-formed (invalid token)
...
0
votes
2
answers
87
views
11ty Pagination Returns number in file structure - how do I prevent this from happening?
I'm trying to create a page per item of data from my CMS in 11ty. The data has pulled through nicely, and each page outputs nicely. However, when created a permalink I'm getting:
public/page-title/1/...
2
votes
1
answer
59
views
script not loading after navigate from one page to another page nunjucks
i am creating website using nunjucks and express, its king of blog website and content coming from prismic. i want to load one script file for active campane form when user navigate from blog list ...
1
vote
1
answer
129
views
11ty: --incremental not having any effect?
I'm using this on my package.json
{
"name": "blog-11ty",
"version": "1.0.0",
"description": "",
"main": ".eleventy.js&...
0
votes
1
answer
41
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 ...
0
votes
1
answer
51
views
Enforce same-origin in Netlify function? (cors)
I am looking to enforce that requests come from the desired origin in process.env.URL in my Netlify site. But currently I can both cURL and make requests with Postman and get a response data back with ...
0
votes
1
answer
60
views
"Last Modified" won't apply to custom variables
According to the 11ty docs, the "Last Modified" string should be replaced for the file modification file.
However, this doesn't seem to be the case.
---
date: 2021-07-12
modified: Last ...
1
vote
1
answer
73
views
Get current month in Eleventy using Nunjucks?
Just trying to get the current month in Eleventy with a shortcode but having a bit of trouble.
Here's where I'm at:
config.addShortcode("month", () => {
let d = new Date();
let month = ...
0
votes
1
answer
36
views
Nunjucks for loop running twice
I'm building a website using Nunjucks and Eleventy. I'm attempting to create an unordered list with a Nunjucks for loop (the data is stored in a JSON file). Everything appears to be working, except ...