Configuration Options

build.extraPackages#

Extra packages that will be joined with the final website package.

Type: attribute set of package

Default: { }

Example:

{
  stylesheetPackage =
      let
        bulma = pkgs.fetchFromGitHub {
          owner = "jgthms";
          repo = "bulma";
          rev = "1.0.4";
          hash = "sha256-hlejqBI6ayzhm15IymrzhTevkl3xffMfdTasZ2CmAas=";
        };

        deps = pkgs.linkFarm "nixtml-docs-stylesheet-deps" [
          {
            name = "bulma";
            path = bulma;
          }
        ];
      in
      pkgs.stdenv.mkDerivation {
        name = "nixtml-docs-stylesheet";

        src = ./stylesheet;

        buildInputs = with pkgs; [
          dart-sass
        ];

        buildPhase = ''
          sass --load-path "${deps}" main.scss main.css
        '';

        installPhase = ''
          mkdir -p $out/css

          cp main.css $out/css/main.css
        '';
      };
}

Declared by:

build.website#

Final built website package.

Type: package

Declared by:

website.baseURL#

Base URL of the generated website. Used for generating permalinks.

Type: string matching the pattern ^https?://.*

Declared by:

website.collections#

Collections allow you to group, paginate and list related content such as blog posts or portfolio pieces.

Type: attribute set of (submodule)

Default: { }

Example:

{
  path = "blog/posts";
  pagination.perPage = 5;
  taxonomies = [ "tags" ];
}

Declared by:

website.collections.<name>.pagination.perPage#

Number of collection item per page when rendering the pagination.

Type: signed integer

Default: 5

Declared by:

website.collections.<name>.path#

Path to folder in config.website.content.dir that contains items for the collection.

For example if all blog posts are kept in ./content/blog/posts and config.website.content.dir = ./content;, setting this option to "blog/posts" will create a collection for the blog posts. The collection will automatically create pages (such as page 1 at blog/index.html, page 2 at blog/page/2/index.html, etc.) using template config.website.layouts.collection and an RSS feed for the collection (if enabled) at blog/index.xml.

Type: string

Declared by:

website.collections.<name>.rss.enable#

Whether or not to automatically create an RSS feed for this collection.

Type: boolean

Default: true

Declared by:

website.collections.<name>.rss.limit#

Max number of collection items to include in the RSS feed.

Type: signed integer

Default: 50

Declared by:

website.collections.<name>.taxonomies#

Taxonomies to enable for the collection.

Type: list of string

Default: [ ]

Example:

[
  "tags"
]

Declared by:

website.content.dir#

Path to a directory with markdown content.

Type: absolute path

Declared by:

website.content.pages#

Attribute set of pages to be processed by a content processor (see config.website.content.processors). The content can come either from text or source.

Keep in mind that nixtml will automatically populate this by walking config.website.content.dir and finding content.

Type: attribute set of (submodule)

Default: { }

Example:

{
  "index" = {
    text = ''
      ---
      title: Homepage
      ---
      # Welcome!

      Welcome to the hompage
    '';
    processor = "md";
  };
  "nested/page" = {
    source = ./path/to/page.md;
    processor = "md";
  };
}

Declared by:

website.content.pages.<name>.processor#

Name of the processor to use to render the page content.

Type: value "md" (singular enum)

Default: "md"

Declared by:

website.content.pages.<name>.source#

Path to to a source file with content that should be processed with the desired processor.

Type: absolute path

Declared by:

website.content.pages.<name>.text#

Content that should be processed with the desired processor.

Type: null or string

Default: null

Declared by:

website.content.processors.md.extraPythonPackages#

Extra python packages to use for processing markdown content.

Type: list of package

Default: [ ]

Declared by:

website.content.processors.md.settings.dateFormat#

Format string for any datetime in content front matter.

This is a format string for python's strftime. See: https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior

Type: string

Default: "%b %-d, %Y"

Declared by:

website.content.processors.md.settings.highlight.style#

The pygments style to use for code block colorscheme.

Type: string

Default: "default"

Declared by:

Set to true to cause all headers to link to themselves.

Type: boolean

Default: false

Declared by:

website.content.processors.md.settings.toc.anchorlinkClass#

CSS class(es) used for the link.

Type: string

Default: "toclink"

Declared by:

website.content.processors.md.settings.toc.marker#

Text to find and replace with the Table of Contents.

Set to an empty string to disable searching for a marker, which may save some time, especially on long documents.

Type: string

Default: "[TOC]"

Declared by:

Set to true or a string to generate permanent links at the end of each header.

When set to true the paragraph symbol (¶ or “&para;”) is used as the link text. When set to a string, the provided string is used as the link text.

Type: boolean or string

Default: false

Declared by:

website.content.processors.md.settings.toc.permalinkClass#

CSS class(es) used for the link.

Type: string

Default: "headerlink"

Declared by:

website.content.processors.md.settings.toc.title#

Title to insert in the Table of Contents’ <div>.

Type: null or string

Default: null

Declared by:

website.content.processors.md.settings.toc.titleClass#

CSS class used for the title contained in the Table of Contents.

Type: string

Default: "toctitle"

Declared by:

website.content.processors.md.settings.toc.tocClass#

CSS class(es) used for the <div> containing the Table of Contents.

Type: string

Default: "toc"

Declared by:

website.files#

Files written to the website build output.

Type: attribute set of (submodule)

Default: { }

Declared by:

website.files.<name>.path#

Path of output file.

Type: string

Default: "‹name›"

Declared by:

website.files.<name>.source#

Path of the source file.

Type: absolute path

Declared by:

website.files.<name>.text#

Text of the output file.

Type: null or strings concatenated with "\n"

Default: null

Declared by:

website.layouts.base#

Base template used as the skeleton for every page defined in config.website.pages.

Type: function that evaluates to a(n) (string or (list of string) convertible to it)

Example:

let
  inherit (lib.tags)
    html
    head
    body
    title
    div
    meta
    ;
  inherit (lib) attrs;
  inherit (config.website) metadata;
in {path, content, ...}:
  "<!DOCTYPE html>\n"
  +
    html
      [ (attrs.lang metadata.lang) ]
      [
        (head
          [ ]
          [
            (title metadata.title)
            (meta [
              (attrs.property "og:type")
              (attrs.content (if path == [ "index" ] then "website" else "article"))
            ])
          ]
        )
        (body
          [
            (attrs.classes [
              "font-sans"
              "bg-white"
            ])
          ]
          [
            (div
              [
                (attrs.classes [ "container" ])
              ]
              [ content ]
            )
          ]
        )
      ]

Declared by:

website.layouts.collection#

Template used for rendering pagination of items in a collection. See config.website.collections.

Type: function that evaluates to a(n) (string or (list of string) convertible to it)

Declared by:

website.layouts.home#

Template used for rendering index.md inside config.website.content.dir.

Type: function that evaluates to a(n) (string or (list of string) convertible to it)

Declared by:

website.layouts.page#

Template used for rendering any parsed markdown file (apart from index.md) inside config.website.content.dir.

Type: function that evaluates to a(n) (string or (list of string) convertible to it)

Declared by:

website.layouts.partials#

Arbritary attribute set of templates to be used in the main layouts.

Type: attribute set of function that evaluates to a(n) (string or (list of string) convertible to it)

Default: { }

Declared by:

website.layouts.taxonomy#

Template used for rendering pagination of items in a taxonomy of a collection. See config.website.collections.<name>.taxonomies.

Type: function that evaluates to a(n) (string or (list of string) convertible to it)

Declared by:

website.metadata#

Website wide metadata to be used for templating the website.

Type: attribute set of anything

Default: { }

Declared by:

website.name#

Name of the website.

Type: string

Declared by:

website.pages#

Attribute set of pages to be templated and put in the final build output. Keep in mind that setting config.website.content.dir and config.website.collections populates this attribute set with pages it generates.

Templated pages are automatically passed to config.website.files and included in the final website build derivation.

Type: attribute set of (submodule)

Default: { }

Declared by:

website.pages.<name>.extraContext#

Extra context to pass on to the layout template when rendering this page.

Type: lazy attribute set of anything

Default: { }

Declared by:

website.pages.<name>.lastModified#

Date in the W3C Datetime format. This is used for generating sitemap.xml.

Type: null or string

Default: null

Declared by:

website.pages.<name>.layout#

The layout template to use to render this page.

Type: function that evaluates to a(n) (string or (list of string) convertible to it)

Declared by:

website.pages.<name>.path#

The final path of the of the page.

The value is normalized when generating the final website output.

  • If this ends with .html, the value is unchanged. Example: 404.html.
  • If this ends with index, only .html is appended. Example: about/index -> about/index.html.
  • Otherwise /index.html is appended. Example: about -> about/index.html.

Type: string

Default: "‹name›"

Declared by:

website.sitemap.enable#

Whether or not to automatically generate a sitemap.xml file in the website build output.

Type: boolean

Default: true

Declared by:

website.static.dir#

Path to a directory with static content. All files will be copied to the final build derivation as is.

Type: null or absolute path

Default: null

Declared by: