parseTemplateName

function
function parseTemplateName(
  relativePath: string
): Pick<
  TemplateDescriptor,
  "outputPattern" | "format" | "perItem" | "variable"
>;

Parse a template's relative path into its descriptor fields.

The @var convention can appear in any path segment — either in the
filename itself or in a directory name:

  • @slug.md.template → variable slug (flat, filename)
  • examples/@example/index.md.template → variable example (nested, directory)

PARAMETERS

NAMETYPEDESCRIPTION
relativePathstringPath relative to the templates root, e.g. `examples/@example/index.md.template`

RETURNS

Pick<TemplateDescriptor, "outputPattern" | "format" | "perItem" | "variable">