title: Diplodoc (redirects.yaml)
type: object
properties:
  vcs:
    oneOf:
      - type: boolean
        markdownDescription: '**`boolean`**'
      - $ref: '#/definitions/VcsConfig'
    description: Enable VCS-based redirect tracking (detects renames from Git history).
    markdownDescription: |-
      **`boolean | VcsConfig`** Enable VCS-based redirect generation.

      - `true` — track file renames using the full Git commit history
      - Object — enable with a specific `initialCommit` as the history start point

      ```yaml
      vcs:
        initialCommit: abc1234
      ```
    defaultSnippets:
      - label: VCS redirects with initial commit
        body:
          initialCommit: ${1:abc1234def5678}
patternProperties:
  ^(?!vcs$).+$:
    type: array
    items:
      $ref: '#/definitions/Redirect'
    markdownDescription: '**`Redirect[]`**'
definitions:
  VcsConfig:
    type: object
    required:
      - initialCommit
    properties:
      initialCommit:
        type: string
        markdownDescription: '**`string`** Git commit SHA to use as the starting point when scanning history for file renames. Commits older than this are ignored.'
        description: Commit SHA used as the start of the Git history scan for renames.
    additionalProperties: false
    markdownDescription: '**`VcsConfig`** VCS-based redirect tracking configuration.'
    description: VCS redirect tracking configuration.
  Redirect:
    type: object
    required:
      - from
      - to
    properties:
      from:
        type: string
        markdownDescription: '**`string`** Old URL path to redirect **from** (e.g. `old/page.html`). Relative to the docs root, without a leading `/`.'
        description: Old URL path to redirect from (relative, without leading slash).
      to:
        type: string
        markdownDescription: '**`string`** New URL path to redirect **to** (e.g. `new/page.html`). Relative to the docs root, without a leading `/`.'
        description: New URL path to redirect to (relative, without leading slash).
    additionalProperties: false
    markdownDescription: |-
      **`Redirect`** A single URL redirect rule.

      Both `from` and `to` are paths relative to the documentation root (without leading `/`).
    description: A single redirect rule mapping an old URL path to a new one.
markdownDescription: |-
  Diplodoc redirects file (`redirects.yaml`).
  Defines URL redirects that are applied during the `publish` step. Each redirect maps a set of old paths to a new path.
  ```yaml # Simple redirect old/path.md:
    - from: old/path.html
      to: new/path.html

  # VCS-based redirects (track file renames via Git history) vcs: true ```
