Skip to content

Instantly share code, notes, and snippets.

@5t3ph
Created August 23, 2020 02:35
Show Gist options
  • Save 5t3ph/a4d990bf83a5c25a928ae06ad9bf317e to your computer and use it in GitHub Desktop.
Save 5t3ph/a4d990bf83a5c25a928ae06ad9bf317e to your computer and use it in GitHub Desktop.
Basic 11ty Starting Point

Begin the Project

npm init -y && npm install @11ty/eleventy

Update scripts in package.json

  "scripts": {
    "develop": "eleventy --serve",
    "build": "eleventy"
  },

Create the Site Index File

Create src/

Create src/index.md

Create the base Layout

Create _includes/base.njk

Emmet: html:5

Add title From Frontmatter

  • <title>{{ title }}</title>
  • <h1>{{ title }}</h1>

Accept Markdown File Content

After h1 add:

{{ content | safe }}

Add layout to index.md

Add to the frontmatter:

layout: base.njk

Add Eleventy Config

Create at project root: .eleventy.js

Add as contents:

module.exports = function (eleventyConfig) {
  return {
    dir: {
      input: "src",
      output: "public",
    },
  };
};

Run the Develop Server

npm run develop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment