File tree
Styled directory tree for showing project or repository structure.
The filetree shortcode renders a styled directory tree. Write the tree using standard box-drawing characters. Folder names (ending with /) are highlighted in the primary color and tree connector characters are rendered in a muted tone.
Usage
{{< filetree >}}
content/
├── docs/
│ ├── _index.md
│ └── getting-started.md
├── blog/
│ └── first-post.md
└── _index.md
{{< /filetree >}}content/├── docs/│ ├── _index.md│ └── getting-started.md├── blog/│ └── first-post.md└── _index.md
Generating the tree text
Use the tree command to generate the input on Linux and macOS:
tree -F --noreport content/On Windows (PowerShell):
tree /F contentCopy the output directly into the shortcode body.
Common box-drawing characters
| Character | Unicode | Meaning |
|---|---|---|
├── |
U+251C U+2500 U+2500 | Branch (more items follow) |
└── |
U+2514 U+2500 U+2500 | Last branch |
│ |
U+2502 | Vertical connector |
Most terminals and editors insert these automatically when using tree.
Notes
- Lines ending with
/are treated as folders and styled with the primary color. - All other non-blank lines are treated as files.
- Horizontal scrolling is enabled so long paths do not break the layout.
Was this page helpful?
Thanks for your feedback!