About

Review feature info and customization details.

Intro to Jumpstart

This jumpstart is intended to be just enough to be a functional site/blog using 11ty, and also to introduce essential 11ty features.

Review the "Quick Start" on the home page for how to get this starter up and running for your project.

Colophon

Hi, I'm Stephanie Eckles - @5t3ph on Twitter, Github, CodePen, and DEV. You may know me as the author of ModernCSS.dev or the creator of StyleStage.dev. I can also be found on egghead as an instructor.

Check out my extended collection of Eleventy resources available on 11ty.Rocks!

Jump to:

Global Site Data and .env

As noted in the Quick Start, there are global site data variables in src/_data/meta.json.

Those include:

.env

See .env-sample for the single expected value of URL which should be set to your localhost. The sample uses the default 11ty port, so you can simply rename the file to .env if you haven't changed the port.

The URL value is then available via the global data described previously, and can be used in templates with meta.url. You can see this used for the RSS feed and sitemap to create the absolute URLs.

Template Languages Used

Page templates are created as Nunjucks (.njk), and feature are added that expect Markdown for most page content.

The home page - src/index.njk - is set to process first as Markdown followed by Nunjucks. This allows mixing HTML with Markdown, with benefits being code syntax highlighting and ability to include classes on HTML elements. This functionality is provided by the templateEngineOverride: md, njk in the frontmatter.

Review the list of available templating languages in the 11ty docs.

Layout Hierarchy and Features

There are two layouts and one partial included.

New in v1.1.0 - layouts are customized to be located in src/_layouts.

The src/index.njk template chains to the base layout and includes a loop that will create "cards" for everything in collections.pages.

Expected Frontmatter

There are only two fields expected:

If you want typed front matter, consider my plugin for collection schemas

The default setup expects content - using any template language - within pages/.

The pages.json in that directory includes a permalink setting so that the file name is used directly to prevent 'pages' being the base of the URL.

You can override permalinks per file.

Asset Handling

In the .eleventy.js config, there are included "pass-throughs" for an img/ directory as well as favicon.png.

You can replace the included favicon, and create an img directory or remove the addPassthroughCopy if you do not have need of images.

Creating an img directory and keeping the pass-through directive will make images available at /img/[image-file-path] relative to the site root.

Linting

A prettier config is included, with the only update being printWidth: 100.

As of v2.0.0, stylelint was removed.

Sass Framework

Review the styling documentation for the included minimal Sass framework, particularly the theme variables, to quickly customize the starter.

The only notable differences are:

  1. sitenav - adjust the styles for the navigation header that appears on pages
  2. tdbc-anchor - styles for the # anchor that appears next to page headings (or turn that feature off) can be adjusted in sass/_utilities
  3. Additional article-scoped styling for typography as it appears on pages
  4. A theme for the prism syntax highlighting for code blocks. You can adjust or replace the theme in sass/_prism.

Additionally, the Sass in this starter is processed using LightningCSS by way of my plugin: @11tyrocks/eleventy-plugin-sass-lightningcss. This affords you access to some super modern CSS features, if you choose to use them.

Fonts

The default font is Baloo 2 and is locally hosted with files in fonts/. If you swap to a different font, be sure to remove the font files as well as the @font-face rules at the top of sass/_fonts.scss, and update the $tdbc-font-family Sass variable.

Anchor links next to headings throughout Markdown content are generated by an add-on plugin for markdownIt.

This feature can be adjusted or removed in the .eleventy.js config file.

Generated Features

Sitemap

A sitemap.xml is generated from all available content.

To exclude non-page or non-public content from the sitemap, include eleventyExcludeFromCollections: true in frontmatter, or create a custom filter.

RSS Feed

An RSS feed is included, and output at [siteurl]/feed/feed.xml.

If publishing from Netlify, the included netlify.toml file will create a redirect so that the feed becomes available at [siteurl]/feed.

Prism Syntax Highlighting

Syntax highlighting of inline or code blocks found within Markdown content is provided by Prism via @11ty/eleventy-plugin-syntaxhighlight.

You can change the theme used in sass/_prism.scss.

Or, remove the plugin if you are not in need of code highlighting.

.eleventy.js Config Features

Overrides

Also, markdownLibrary is extended to add the markdownItAnchor plugin for anchor links.

Shortcode: year

Returns the current YYYY year, used by the footer copyright.

Filter: slug

Makes the default slug function more strict to ensure things like excluding emojis and enforcing lowercase.

VSCode Tips

Nunjucks

If you haven't previously worked with Nunjucks, you will want a syntax highlighting extension: Nunjucks

In addition, you may want to ensure Emmet works on .njk files by updating/adding the following in the settings.json:

"emmet.includeLanguages": {
	"nunjucks": "html",
},

Formatting

As noted previously, a prettier config is included, and you may want to get the Prettier extension and update your VSCode settings to "Format on Save".

However, to format template files Prettier doesn't recognize like .njk, you can update the "Language Mode" on the currently open file from "Nunjucks" (or other current templating language) to "HTML" to allow formatting to be applied. Then, flip it back to re-allow the syntax highlighting if needed.

This is located in the VSCode bottom toolbar near the right-hand side and will display the value of the current file's detected language. Click the name to open the selector.