| title: | Building Static Sites with Eleventy | |||
|---|---|---|---|---|
| description: | A guide to getting started with Eleventy static site generator | |||
| date: | 2024-01-20T00:00:00.000Z | |||
| tags: |
|
Eleventy (11ty) is a simpler static site generator that's gained popularity for its flexibility and ease of use. In this post, I'll share some tips for building great static sites with Eleventy.
Eleventy supports many template languages out of the box:
Collections are a powerful way to group related content:
// In .eleventy.js
eleventyConfig.addCollection("posts", function(collectionApi) {
return collectionApi.getFilteredByGlob("src/posts/*.md");
});
Custom filters help transform data:
eleventyConfig.addFilter("readableDate", dateObj => {
return DateTime.fromJSDate(dateObj).toFormat("dd LLL yyyy");
});
_data/Eleventy makes it easy to build fast, maintainable static sites. Give it a try for your next project!