mount
On this page
Mount
Map local files or directories into your site. Sources may be inside the site or in another project. For example, expose another project's documentation under content/docs/project-name/, or a single CSS file at static/style.css.
hooks: mount: enabled: true option: - source: "/tmp/project-name/docs" target: "content/docs/project-name" strategy: "source" - source: "/tmp/project-name/static/style.css" target: "static/style.css"
| Field | Description |
|---|---|
source |
Required local file or directory |
target |
Required destination within the site |
lang |
Optional configured language code, such as zh or en |
strategy |
Optional merge strategy; defaults to source |
Targets use site-relative paths such as content/docs/demo, static/style.css, or templates/partials/card.html. Absolute paths and . or .. segments are not allowed.
A directory contributes its contents beneath the target. A file is exposed at the target path itself. The development server does not watch external sources; rebuild or restart the preview after changing them.
Merge Strategies
| Strategy | Behavior |
|---|---|
source |
Merge both sides; mounted source files win on conflicts |
target |
Merge both sides; existing target files win on conflicts |
override |
Use only mounted content at the target, without falling back to existing files |
The legacy names mount and base are aliases for source and target, respectively.
Language-Specific Content Directories
Store translations in separate directories with matching filenames and layouts:
content/docs/note/ ├── zh/ │ ├── _index.md │ ├── intro.md │ └── guide/ │ ├── _index.md │ └── intro.md └── en/ ├── _index.md ├── intro.md └── guide/ ├── _index.md └── intro.md
Mount both directories at the same destination and assign each a language:
language: zh languages: en: base_url: https://example.com hooks: mount: enabled: true option: - source: content/docs/note/zh target: content/docs/note lang: zh - source: content/docs/note/en target: content/docs/note lang: en
lang sets the language in mounted pages' and sections' front matter, so filenames can remain intro.md and _index.md. Language-specific sources inside the site's content/ directory are skipped at their original location and read only through the mount target. Subdirectories are mapped automatically.
With default paths, the Chinese and English guide/intro.md files produce /docs/note/guide/intro/ and /en/docs/note/guide/intro/. Each note section contains its own guide child section and intro page.
Current Limitations
- Files in a parent and a language directory that resolve to the same language and path, such as
note/intro.mdandnote/zh/intro.md, may produce duplicate links in section lists. - When languages have identically named attachments,
assets: [cover.txt]finds only the first file. Use a wildcard such asassets: ["*.txt"]or automatic page-bundle collection. - Do not mix an
index.mdpage bundle in one language with an_index.mdsection at the same logical directory in another language. The bundle causes child scanning to stop, omitting the other language's section and pages.