Go to file
2024-03-07 07:57:06 -06: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
.github/workflows GitHub workflow cache key 2024-03-07 07:57:06 -06: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 Add cache to gitignore 2024-02-12 09:16:51 -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 Add support for full URLs in image plugin. 2024-01-14 12:35:07 +13: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 Upgrade dep 2023-09-22 16:31:49 -05:00
README.md Link to CSP 2023-10-05 08:32:54 -05:00

eleventy-base-blog v8

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).