Go to file
2024-02-13 09:30:54 -06:00
_data Status 2024-01-14 12:32:15 +13:00
_includes Status 2024-01-14 12:32:15 +13:00
content Link to input file. 2024-02-12 09:19:30 -06:00
public One more tweak to heading links 2023-01-24 09:19:02 -06:00
.editorconfig Convert to tabs 2023-01-23 11:37:44 -06:00
.gitignore Initial commit. 2018-01-16 21:08:47 -06:00
.nojekyll Fixes https://github.com/11ty/eleventy-base-blog/issues/87 2022-06-29 14:28:21 -05:00
.nvmrc Update the Node default 2022-05-13 16:11:39 -05:00
eleventy.config.drafts.js v9 switches to ESM 2023-11-10 16:41:13 -06:00
eleventy.config.images.js Moved some comments to the official docs. 2024-02-13 09:30:54 -06:00
eleventy.config.js Use new Image optimization transform 2024-02-12 09:19:19 -06:00
LICENSE Tiny tweaks 2023-01-23 11:37:54 -06:00
netlify.toml A bit more clarity on copy 2023-01-24 10:38:55 -06:00
package.json Use new Image optimization transform 2024-02-12 09:19:19 -06:00
README.md Status 2024-01-14 12:32:15 +13:00

eleventy-base-blog v9

A starter repository showing how to build a blog with the Eleventy site generator (using the v2.0 release).

Getting Started

  1. Make a directory and navigate to it:
mkdir my-blog-name
cd my-blog-name
  1. Clone this Repository
git clone https://github.com/11ty/eleventy-base-blog.git .

Optional: Review eleventy.config.js and _data/metadata.js to configure the sites options and data.

  1. Install dependencies
npm install
  1. Run Eleventy

Generate a production-ready build to the _site folder:

npx @11ty/eleventy

Or build and host on a local development server:

npx @11ty/eleventy --serve

Or you can run debug mode to see all the internals.

Features

Demos

Deploy this to your own site

Deploy this Eleventy site in just a few clicks on these services:

Implementation Notes

  • content/about/index.md is an example of a content page.
  • content/blog/ has the blog posts but really they can live in any directory. They need only the posts tag to be included in the blog posts collection.
  • Use the eleventyNavigation key (via the Eleventy Navigation plugin) in your front matter to add a template to the top level site navigation. This is in use on content/index.njk and content/about/index.md.
  • Content can be in any template format (blog posts neednt exclusively be markdown, for example). Configure your projects supported templates in eleventy.config.js -> templateFormats.
  • The public folder in your input directory will be copied to the output folder (via addPassthroughCopy in the eleventy.config.js file). This means ./public/css/* will live at ./_site/css/* after your build completes.
  • Provides two content feeds:
    • content/feed/feed.njk
    • content/feed/json.njk
  • This project uses three Eleventy Layouts:
    • _includes/layouts/base.njk: the top level HTML structure
    • _includes/layouts/home.njk: the home page template (wrapped into base.njk)
    • _includes/layouts/post.njk: the blog post template (wrapped into base.njk)
  • _includes/postslist.njk is a Nunjucks include and is a reusable component used to display a list of all the posts. content/index.njk has an example of how to use it.

Content Security Policy

If your site enforces a Content Security Policy (as public-facing sites should), you have a few choices (pick one):

  1. In base.njk, remove <style>{% getBundle "css" %}</style> and uncomment <link rel="stylesheet" href="{% getBundleFileUrl "css" %}">
  2. Configure the server with the CSP directive style-src: 'unsafe-inline' (less secure).