Adding a git repository
Link your documentation to its source repository. This adds an "Edit this page" button and shows the repository name in the header.
Basic configuration
repo_name: username/repo
repo_url: https://github.com/username/repo
Edit button
Enable the "Edit this page" button:
theme:
features:
- content.action.edit
This adds a pencil icon that links directly to the source file on GitHub (or your provider).
View source button
Enable the "View source" button alongside edit:
theme:
features:
- content.action.edit
- content.action.view
Custom provider
DocsForge supports any Git provider that follows the GitHub URL pattern:
repo_url: https://gitlab.com/username/repo
# or
repo_url: https://bitbucket.org/username/repo
# or
repo_url: https://gitea.example.com/username/repo
Repository icon
The repository icon is shown in the header. It's automatically determined from the URL:
github.com→ GitHub icongitlab.com→ GitLab iconbitbucket.org→ Bitbucket icon
Custom edit path
If your docs live in a subdirectory of the repository:
edit_uri: edit/main/docs/
The full edit URL becomes: https://github.com/username/repo/edit/main/docs/page.md
Complete example
repo_name: myproject/docs
repo_url: https://github.com/myproject/docs
edit_uri: edit/main/docs/
theme:
features:
- content.action.edit
- content.action.view
Next steps
Troubleshooting
Edit button 404s
If the edit button leads to a 404 page:
- Check
edit_urimatches your repository structure - For GitHub:
edit_uri: edit/main/docs/(branch + docs folder) - For GitLab:
edit_uri: edit/main/docs/-/blob/(different path format) - Ensure the repository is public (or the user has access)
Wrong icon showing
The repository icon is auto-detected from the URL. If the wrong icon appears:
- Check
repo_urlis correct - For custom icons, set
icon.repoindocsforge.yml:
icon: repo: fontawesome/brands/github
Private repositories
For private repositories, the edit button still works for users with access:
repo_url: https://github.com/mycompany/private-docs
Users who don't have access will see a 404 when clicking the edit button. Consider adding a note about this in your documentation.