This page lists all available configuration options for Harold. Configuration can be placed in any of these locations:
harold property in package.json.haroldrc file (JSON or YAML).haroldrc.json, .haroldrc.yaml, .haroldrc.yml file.haroldrc.js or harold.config.js file (CommonJS)mdFilesDirNameType: string
Default: 'posts'
The directory name for markdown blog post files.
Example:
{
"mdFilesDirName": "docs"
}
Use Case: Change to docs for documentation sites, or articles for article-based sites. This name is used in URLs (e.g., /docs/article-name).
mdFilesLayoutsDirNameType: string
Default: 'blog-layouts'
The directory name for markdown file layout templates.
Example:
{
"mdFilesLayoutsDirName": "docs-layouts"
}
Use Case: Keep layouts organized by purpose. If using mdFilesDirName: "docs", you might want mdFilesLayoutsDirName: "docs-layouts" for clarity.
outputDirNameType: string
Default: 'build'
The directory name for built/compiled output files.
Example:
{
"outputDirName": "dist"
}
Use Cases:
"dist" for distribution directory"docs" for GitHub Pages hosting (required by GitHub)"public" if deploying to certain hosting serviceshostDirNameType: string
Default: '' (empty - site hosted at root)
The subdirectory name if hosting your site in a subdirectory rather than root.
Example:
{
"hostDirName": "blog"
}
Use Case: If your site is hosted at www.example.com/blog/ instead of www.example.com/, set this to "blog". Harold will adjust all internal paths accordingly.
Note: The default Harold templates use the relativePath helper which automatically handles this configuration.
minifyCssType: boolean
Default: true
Enable or disable CSS minification.
Example:
{
"minifyCss": true
}
Details:
When to disable: Only for debugging CSS issues or if you have a custom minification process.
minifyHtmlType: boolean
Default: true
Enable or disable HTML minification.
Example:
{
"minifyHtml": true
}
Details:
When to disable: Only for debugging HTML structure issues or inspecting generated HTML.
Here's a complete .haroldrc configuration file with all options:
{
"mdFilesDirName": "docs",
"mdFilesLayoutsDirName": "docs-layouts",
"outputDirName": "build",
"hostDirName": "",
"minifyCss": true,
"minifyHtml": true
}
{
"mdFilesDirName": "docs",
"mdFilesLayoutsDirName": "docs-layouts",
"outputDirName": "build"
}
{
"outputDirName": "docs"
}
{
"outputDirName": "docs",
"hostDirName": "my-project"
}
{
"mdFilesDirName": "articles",
"mdFilesLayoutsDirName": "article-layouts",
"outputDirName": "dist"
}
{
"minifyCss": false,
"minifyHtml": false
}
Note: Consider using environment-based config files (.haroldrc.dev.js, .haroldrc.prod.js) for different environments.
You can also place configuration directly in package.json:
{
"name": "my-harold-site",
"version": "1.0.0",
"harold": {
"mdFilesDirName": "docs",
"outputDirName": "dist",
"minifyCss": true
}
}
These directories are used internally and cannot be configured:
src - Source directory (always used)pages - Handlebars page filespartials - Handlebars partial filesstyles - SCSS/CSS filesassets - Images, fonts, JavaScriptjsonData - Auto-generated JSON datastatics - Static files copied to rootAll of these directories are optional (since v1.3.0). Harold will gracefully skip missing directories.
Harold will:
minifyCss and minifyHtmlHarold searches for configuration in this order (first found wins):
.haroldrc in the src directory (template-specific)harold key in package.json.haroldrc in project root.haroldrc.json, .haroldrc.yaml, .haroldrc.yml.haroldrc.js, harold.config.jsTip: Template-specific .haroldrc in src/ overrides project-level configuration.
For different configurations in development vs production:
Option 1: Multiple config files
# Development
cp .haroldrc.dev .haroldrc
# Production
cp .haroldrc.prod .haroldrc
Option 2: JavaScript config with environment variables
.haroldrc.js:
module.exports = {
mdFilesDirName: 'posts',
outputDirName: 'build',
minifyCss: process.env.NODE_ENV === 'production',
minifyHtml: process.env.NODE_ENV === 'production'
};
Then use:
NODE_ENV=development npm start
NODE_ENV=production npm run build