Skip to main content

Configuration Overview

You configure Doxicity by passing a configuration object in Doxicity’s constructor. This allows you to immediately call publish() to process your website.

import Doxicity from 'doxicity';

const __dirname = new URL('.', import.meta.url).pathname;

// Configure it
const dox = new Doxicity({
  source: Doxicity.resolve(__dirname),
  destination: Doxicity.resolve(__dirname, '_site'),
  baseUrl: 'https://example.com/'
  // more options here...
});

// Publish it
dox
  .publish()
  .catch(err => {
    console.log(err.message);
  });

Configuration Options

The following options are available as part of the DoxicityConfig interface.

Option Type Description Default
source string The directory containing markdown files to publish. For best results, use a fully resolved path. "."
destination string The directory where HTML files will be generated. For best results, use a fully resolved path. "./_site"
baseUrl string The base URL that the website will be published to. To generate fully qualified URLs, make sure this starts with “http://” or “https://”. "/"
layouts string The name of the directory that contains layouts. Must be relative to the project’s source directory. This is where .hbs layouts are expected to be found. Defaults to “layouts”. "layouts"
partials string The name of the directory that contains partials. Must be relative to the project’s source directory. This is where .md and .hbs partials are expected to be found. Defaults to “partials”. "partials"
assets string The name of the directory that contains the project’s assets such as images, styles, scripts, etc. Must be relative to the project’s source directory. This directory will be copied to the output directory as-is on publish. Nothing will be copied unless this option is set. ""
sharedScripts string The name of the file that contains shared stylesheets, such as those generated by plugins. Must be relative to the project’s destination directory. Doxicity will publish shared styles to this file and automatically link them from each page to leverage caching and optimize load times. The filename must end in .css. The default value is shared/shared.css.
sharedStyles string The name of the file that contains shared scripts, such as those generated by plugins. Must be relative to the project’s destination directory. Doxicity will publish shared scripts to this file and automatically link them from each page to leverage caching and optimize load times. The filename must end in .js. The default value is shared/shared.js.
data object Any data you put here will be available in your HTML and markdown files through the use of Handlebars expressions. If you use front matter in your markdown files, that data will be merged with this data with the front matter taking precedence. {}
cleanBeforePublishing boolean When true, Doxicity will delete the destination directory before writing anything to it. false
plugins DoxicityPlugin[] Optional plugins to customize how pages are published. Plugins are executed in the order they’re provided in your configuration. []
helpers DoxicityHelper[] Optional helpers to extend Handlebars with. To learn more about what helpers are and how they work, refer to the Handlebars documentation . []
filterPages (page:DoxicityPage) => boolean A callback function that accepts a filename. If this function returns true, the target file will be published. If it returns false, the file will be ignored. () => true
pageExtension string The extension to use when publishing pages. Defaults to html. html