Skip to content

Since 0.25.0

getMarkdownUrl

The Markdown URL of a node's entry page by slug, or of the index page without one.

View Markdown
On this page

Returns the absolute URL of a page's Markdown: the page's URL on siteUrl with .md appended. The tree must declare pages.

src/app/docs/[...slug]/page.tsx
docsTree.getMarkdownUrl("guide/cli"); // "https://example.com/docs/guide/cli.md"
docsTree.getMarkdownUrl(); // "https://example.com/docs.md"

Signature

@qino/cms
tree.getMarkdownUrl(slug: Slug): string;
tree.getMarkdownUrl(): string;

Parameters

Returns

string: pages.entry with the slug in place of {slug}, slashes kept, or pages.index, joined to siteUrl. A trailing / is dropped before .md, / gives /index.md, and each slug segment is URL-encoded. It reads no file.

Throws

  • Tree "<directory>" has no pages: declare them to get page Markdown and Markdown URLs.

See also