The content is built in two parts:
- Handlebars templates, partials, and metadata artifacts live in
autogen/. The@repo/netlogo-docshosts shared code of this part. The rest is configured inlib/docs. This generates thecontent/directory consumed by@nuxt/content.- Configured in
lib/docs/autogen.config.ts. - Documented in the Template Package under
ProjectConfigSchema.
- Configured in
- Nuxt Content processes the generated
content/directory to build the final static site via Nuxt. In this step, we use@repo/markdownfor shared and custom markdown plugins and components. They are also configured inlib/docs.- Configured in
content.config.ts. - Documented in the official Nuxt Content documentation.
- Configured in
Handlebars expects frontmatter blocks in YAML format in autogen/ (configurable in autogen.config.ts).
The project configuration is defined in lib/docs/autogen.config.ts. This file defines how the autogen process works, including:
- Where to find the source files (
autogen/by default). - Where to output the generated content (
content/by default). - Default values for various fields.
- How to output metadata (in-file frontmatter vs. separate files, JSON vs. YAML, delimiters, etc).
- Localization settings (where to output localized files, default language, etc).
- Whether to skip write operations if no changes are detected.
You can refer to the ProjectConfigSchema in the Template Package for detailed documentation of all configuration options.
The YAML frontmatter is used to define a page generation task. A YAML file may contain multiple frontmatter blocks, each defining a separate page generation task or used to inherit common metadata for multiple tasks.
The YAML Frontmatter fields are documented in the Template Package under PageDeclarationSchemaFields. Note that sites are allowed to extend this schema with custom fields as per their needs.
The frontmatter may define the following key fields:
output: Defines the output file name or whether to output a file at all.extension: Defines the file extension of the scanned files (e.g..md,.html).language: Defines the language of the output file for localization.inheritFrom: Defines which previous frontmatter blocks in the same file to inherit from (indexed at 0).buildVariables: Defines relative paths to data files to be loaded and made available as variables in the template. This includes other YAMLs, JSON, XML, INI, and NLOGOX files.
Each YAML frontmatter block with output: true will scan for a file with the name <YAML file name>[.<language> if not the default].<extension>] (e.g. getting-started.md, getting-started.es.md) and process it via Handlebars to generate the output file.
An example file structure:
📁 <YOUR APP>
├── 📁 lib/ # !!This part is not strictly-enforced!!
│ └── 📁 docs/
│ ├── 📄 autogen.config.ts # Autogen project configuration
│ ├── 📄 runDocsAutogen.ts # Script to run the autogen process
│ └── 📁 schema.ts # Schema for the output metadata
├── 📁 autogen/ # Source files for autogen
│ ├── 📄 getting-started.md # Markdown file to be processed
│ ├── 📄 getting-started.es.md # Localized markdown file to be processed
│ └── 📄 getting-started.yaml # Metadata for the markdown file
├── 📁 content/ # Generated content consumed by @nuxt/content
│ ├── 📄 getting-started.md # Generated markdown file
│ └── 📄 getting-started.es.md # Generated localized markdown file
└── 📄 content.config.ts # Nuxt Content Configuration
# Inherited block (defined in autogen.config.ts)
tags: # Custom field
- What is NetLogo
- Introduction
- Overview
icon: i-lucide-circle-question-mark # Custom field
---
output: True # Output file will be getting-started.md
# Metadata
title: What is NetLogo?
description:
Introduction to NetLogo, explaining what it is, its purpose, and how it can be
used for agent-based modeling and simulation.
keywords:
- What is NetLogo
- Introduction
- Overview
- Agent-based Modeling
- NetLogo
---
output: getting-started.es.md # Output file will be getting-started.es.md
language: es # Spanish language
# Metadata
title: ¿Qué es NetLogo?
description:
Introducción a NetLogo, explicando qué es, su propósito y cómo se puede usar
para el modelado y la simulación basados en agentes.
keywords:
- Qué es NetLogo
- IntroducciónThere are two important concepts to understand when working with frontmatter:
- Inheritance: A frontmatter block may inherit fields from previous blocks in the same file via the
inheritFromfield. This is useful for defining common metadata for multiple files, such as multiple languages of the same page. This field could be set globally viadefaultsin your autogen config. You may also inherit from multiple previous blocks by specifying an array of indices (e.g.inheritFrom: [0, 1]to inherit from the first and second blocks). Inherited fields can be overridden by defining them again in the current block. - Defaults: The autogen config may define default values for any field via the
defaultsfield. These defaults are applied to all frontmatter blocks unless overridden in the block itself.
You may define new helpers in lib/docs/runDocsAutogen.ts. If you search for .registerHelper, you will find existing helpers as examples.
All files in lib/docs are partials. You can configure this in lib/docs/autogen.config.ts. You can use any partial via the {{> /path/to/partial/in/autogen }} syntax. It is your responsibility to ensure no circular dependencies exist.
You may defined localized versions of a file by defining a language field (e.g. language: es) in your frontmatter. The output file will use the naming strategy defined in your autogen config local.toSlug field. If not defined, it defaults to creating a top-level subdirectory with the language code (e.g. es/filename.md). By default, en is the default language and does not get a subdirectory. You may override defaults in defaults field in your autogen config.
All values defined in your frontmatter are available as variables in your template. In addition to meta fields, the buildVariables field allows you to define relative paths. You may define data files in autogen/data/. The best example of this is autogen/dictionary.md. Supported formats are JSON, YAML, NLOGOX, INI, and XML.
The format expected by @nuxt/content is markdown files with frontmatter metadata. The frontmatter is written in YAML format and is delimited by --- at the start and end of the metadata block. The metadata schema is defined in lib/docs/schema.ts and passed to @nuxt/content via content.config.ts. This schema is strictly enforced during content generation.
Any images or other assets referenced in the documentation can exist in one of two places:
- Under
autogen/: These assets will be copied topublic/_contentduring the build step. You do not need to explicitly reference_contentin your markdown. For example, an image atautogen/images/example.pngcan be referenced in markdown as.
- Do NOT include a leading slash when referencing these assets; use
images/example.pnginstead of/images/example.png. Leading slashes are reserved forpublic/assets rather thanpublic/_content/assets. - Further, if you are using the WikiLink syntax
![[...]]you do not need to specify theimages/prefix; just use![[example.png]].
- Under
public/: These assets will be served as-is. You must use a leading slash when referencing these assets. For example, an image atpublic/images/example.pngmust be referenced in markdown as. You cannot use the WikiLink syntax for these assets.
Any DOM element with src or href attributes pointing to relative paths will be processed internally to resolve to the correct location based on the above rules. Similarly, any metadata field that is a URL (e.g. meta.thumbnail) will also be processed to resolve to the correct location. Note that CSS url(...) references are not processed and must be manually specified to point to the correct location.