Skip to main content

Getting Started

Try It Online

Installation

Prerequisites

  • Node v22 or higher
  • a terminal application for accessing command line interfaces
  • A text editor with support for Markdown is recommended

Initialize Project

Install the package from npm, either standalone or within your existing Eleventy project:

npm i -D @lowfat/eleventy-plugin-lfp-docs

Either manually create a configuration file (e.g., call it eleventy.config.js) or use LFP Docs' CLI:

npx lfpdocs init

Add your files to the newly created /docs directory; edit the newly created eleventy.config.js to pass your configuration to the plugin.

File Structure

By default, LFP Docs assumes to be installed inside another project. You can specify "." as the documentation's input path (config.dir.input) for standalone projects.

When considering the former case, the created file structure looks like this:

.
├─ /docs
│  ├─ # this is where your markdown files go
├─ eleventy.config.js
└─ package.json

Eleventy uses file-based routing, so you do not need to have ordering your source files in mind. Break out of this system by setting a permalink in a particular source file, by which it will be found instead.

Configuration

The configuration file that gets either created by the CLI or yours might look like this:

import lfpDocsPlugin from '@lowfat/eleventy-plugin-lfp-docs';
  
export default function (eleventyConfig) {
  eleventyConfig.addPlugin(lfpDocsPlugin, {
    // add your configuration here
  });

  return {
    dir: {
      data: '_data',
      includes: '_includes',
      input: 'docs',
      layouts: '_layouts',
      output: '_site',
    },
  };
}
eleventy.config.js

You can adjust everything you see in this configuration file to your liking and needs. Refer to the configuration reference for an extensive overview of all options.

While you can leave the configuration empty and LFP Docs would work regardless, some settings are recommended:

  • title: add a title to your documentation to be displayed in the header section

Develop

Test your project with the built-in test server:

npx lfpdocs dev

The development server should be running on http://localhost:8080.

Build

If you are ready to deploy, build your project with:

npx lfpdocs build

The static sites are written to the specified output directory and ready to be deployed to a service of your choosing.