Go to file
2023-04-19 00:34:18 -04:00
_data Remove unnecessary quotes 2023-04-12 16:40:18 -05:00
_includes Refactors style bundling so it's easy to avoid an insecure CSP 2023-04-19 00:34:18 -04:00
content Fixes https://github.com/11ty/eleventy-base-blog/issues/141 2023-02-07 11:07:11 -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 Clean up the drafts code 2023-01-24 15:32:58 -06:00
eleventy.config.images.js A few more features and cleanup 2023-01-24 08:41:50 -06:00
eleventy.config.js Style changes to config 2023-03-28 11:50:12 -05: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 Update deps 2023-04-12 16:40:25 -05:00
README.md Refactors style bundling so it's easy to avoid an insecure CSP 2023-04-19 00:34:18 -04:00

eleventy-base-blog v8

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

Netlify Status

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.

If your site enforces a Content Security Policy (as public-facing sites should), either, in base.njk, disable

<style>{% getBundle "css" %}</style>

and enable

<link rel="stylesheet" href="{% getBundleFileUrl "css" %}">

or configure the server with the CSP directive style-src: 'unsafe-inline' (which is less secure).