Nested folders
Read Markdown from every folder below a root with the ** wildcard, and learn how index.md files get their slug.
On this page
[DataSource("Guides", "./**/*.md")]
public sealed record Guide(string Slug, string Title, string SourcePath, string RawMarkdown);
Use ** to read Markdown (or any list file type) from the folders below the one you name.
- Guides/
- Guide.cs
- overview.md
- intro/
- index.md
- advanced/
- tuning.md
./*.mdreads one folder only.- The part before the first wildcard is the root. Other wildcards are only allowed in the last segment.
- Files are sorted by their path (ordinal,
/separators), so the order is stable. SourcePathis the path relative to the root, for exampleintro/index.md. For./*.mdit is the file name.- A file named
index.md(orindex.markdown) below the root gets the name of its folder as its slug.intro/index.mdhas the slugintro. Aslug:in the front matter still wins. Anindex.mdat the root keeps the slugindex.
Hidden files and links
Recursive reads skip hidden and system entries silently. Bevel never follows symbolic links or other reparse points. It skips each one and prints a build message:
Dataset 'Posts': skipped symbolic link 'content/shared' (symlinks are not followed).
Catch slug clashes
intro.md next to intro/index.md gives two items with the slug intro. Bevel does not check this for you. Add [Unique] to catch it:
public sealed record Guide([Unique(IgnoreCase = true)] string Slug, string Title, string SourcePath, string RawMarkdown);