eleventy | simpler site generator | Static Site Generator library
kandi X-RAY | eleventy Summary
kandi X-RAY | eleventy Summary
A simpler static site generator. An alternative to Jekyll. Written in JavaScript. Transforms a directory of templates (of varying types) into HTML. Works with HTML, Markdown, Liquid, Nunjucks, Handlebars, Mustache, EJS, Haml, Pug, and JavaScript Template Literals.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Add an entry to the server .
- Parses a bunch of blocks
- Parse content of a block .
- Renders a Jade instance
- This is the entry point for the EdgeGraph .
- Parse a template tag
- Main content of a tag
- Wrap a plain object in a closure
- Compiles a template file .
- Event handler for serverless events
eleventy Key Features
eleventy Examples and Code Snippets
Community Discussions
Trending Discussions on eleventy
QUESTION
Im using Eleventy/11ty site generator and I have a myData object structured like this
...ANSWER
Answered 2022-Mar-13 at 13:06You should be able to use computed data + JS front matter to get this to work:
QUESTION
For my personal blogging site (https://victorfeight.com/) served behind Cloudflare pages, I'm using Eleventy with a custom script that include dark mode toggling logic, SPA-like page switches with AJAX, and search functionality with Elasticlunr and JavaScript . As I am new to JavaScript Web development and opted not to use a Framework to achieve SPA page switches, I decided to implement all the logic into a single file, wrapped in an IIFE (passing in window and document). I'm wondering if this is the standard way to implement this sort of logic together, or if I should be using webpack or a more modern solution. I'm also wondering if it's possible to load dark mode/light mode script logic and search mode logic per page, in spite of using an AJAX url-switching logic.
First issue: Certain click event handling logic seems to be interrupting my new dark mode toggle, introduced in the same file. I implemented logic found here for dark mode: https://jec.fyi/blog/supporting-dark-mode And I implemented search functionality using logic found here: https://www.belter.io/eleventy-search/
I have the following HTML in my Liquid template, which is loaded by default:
...ANSWER
Answered 2022-Mar-06 at 20:07Let me take this step my step.
First issue: The click event handling logic
I re-implemented all of my javascript logic into separate files, which get minified by Rollup.js now.
Here is my new rollup build config:
QUESTION
I'm using Eleventy and have created the subfolder yummy
in my global data folder, that contains the following files:
ANSWER
Answered 2022-Feb-20 at 15:46Managed to solve this myself by adding a second loop.
QUESTION
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 the year (YYYY) within the post content. I'm using Nunjucks.
How do i do this?
I've tried
{{ page.date.getFullYear }}
This gives the following error:
function () { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return obj[val].apply(obj, args); }
Any help would be really appreciated - thanks!
...ANSWER
Answered 2022-Feb-06 at 14:00Add a filter to your .eleventy.js file
QUESTION
I'm trying to build a site in Eleventy. The site has blog posts in two collections: A and B. When I'm reading a post in the collection A, I'd like to have a link after the post content that says, "View all A posts". And when I'm reading a post in collection B, I'd like to see a "View all B posts" link.
The blog posts share the same _includes template post.html. In that template, I should be able to create an if statement in nunjucks that goes something like this:
...ANSWER
Answered 2021-Sep-27 at 12:59Given that you have blog posts separated by folder, you can create a directory data file that specifies a value for the directory (A, B). Something like so:
QUESTION
I have a Unity + Zenject setup with a ProjectInstaller
with some global dependencies that adhere to a "modal" interface, e.g.,
ANSWER
Answered 2022-Feb-04 at 17:35The problem is that that ModalManager
can only be injected with dependencies that are added directly to ProjectContext. For these kinds of problems I recommend using the following pattern:
QUESTION
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 in a S3 bucket
- on each file change, run the HTML build
- push the output to a different S3 bucket, which serves the web page
Conceptually, I feel like this would be a standard FaaS use case.
Practically, I stumble over the fact that the Node.js-Lambda runtime always expects an explicit function handler to be invoked. It seems Eleventy does not provide a standard way to be invoked from code (or I have not discovered this yet).
I found that I could build my package into a Docker container and run the npm run
as Entrypoint. This would surely work, but seems unnecessary, since the Lambda-provided Node.js runtimes should be capable of running my npm build command if I put my packages in the deployment artifact.
Do I have a knot in my brain? Anything I'm overlooking? Would be happy about any input.
...ANSWER
Answered 2022-Jan-02 at 18:40I'm not sure this is supported as I don't see it documented, but I looked at the unit tests for Eleventy and saw many examples of this (https://github.com/11ty/eleventy/tree/master/test). I tried the following and it worked. Note that init an write are both async and I do NOT properly await them, I was just trying to get a simple example:
QUESTION
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
could contain:
ANSWER
Answered 2021-Dec-03 at 02:20If you want to define the links in one spot and access them globally in your templates, you can create a global data file in the _data/*
directory containing link definitions and then reference them in your Markdown files. Below is an example global data file _data/links.json
:
QUESTION
I'm using this on my package.json
...ANSWER
Answered 2021-Nov-02 at 15:33I believe incremental is only meant to be used with serve. The docs say:
"Incremental builds perform a partial build operating only on files that have changed to improve build times when doing local development."
In my testing, I confirmed this. I ran eleventy --incremental --serve
and noticed that it would only rebuild one file at a time when I changed it. If you run it by itself, it's going to create a full build every time, as documented here: https://www.11ty.dev/docs/usage/incremental/#cold-start
QUESTION
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 that the loop runs twice, when it should only run once.
JSON
...ANSWER
Answered 2021-Oct-06 at 00:00There was a copy of the JSON file saved inside of my input folder. I deleted it and now the HTML output no longer shows the rendered data an extra time. Thank you, @RaymondCamden!
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install eleventy
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page