Home

Site Layout EditSource Component

Edit source link for GitHub/GitLab/Bitbucket

Displays a link to edit the current page on the source repository. Auto-detects the repository from git origin for github.com, gitlab.com, and bitbucket.org. For self-hosted instances or other platforms, use the base-url option.

The icon shows the platform logo (GitHub, GitLab, or Bitbucket), the default text is "Edit on ", and hovering shows "Edit source on ", e.g.

# Edit-source links with defaults and overrides
[site.layout.footer]
end = "edit-source"  # Auto-detect from git origin

# With custom text:
end = { type = "edit-source", text = "Suggest changes" }

# For self-hosted GitLab:
end = { type = "edit-source", base-url = "https://gitlab.mycompany.com/team/docs/-/edit/main/" }

text

Type: string (optional)

Custom link text

Default: "Edit on " or "Edit source" for custom base-url

style

Type: EditSourceStyle (optional)

Display style

Default: both

ValueDescription
iconPencil/edit icon only
textText only
bothIcon and text (default)

base-url

Type: string (optional)

Full edit URL prefix (e.g., "https://github.com/org/repo/edit/main/")

When provided, the file path is simply appended. Required for self-hosted instances or unsupported platforms (Gitea, Forgejo, etc).

branch

Type: string (optional)

Override branch name for auto-detected URLs

Ignored when base-url is provided.

Default: auto-detect or "main"

path-prefix

Type: string (optional)

Path prefix within repo (e.g., "docs/" if content is in a subdirectory)


This documentation was generated from layout/components.rs by generate.rs.

© 2026 Stencila