The State of Docs Report 2025 is live! Dive in and see why docs matter more than ever:
Read the report
LogoLogo
ProductPricingLog inSign up
  • Documentation
  • Developers
  • Guides
  • Changelog
  • Help Center
  • Getting Started
    • GitBook Documentation
    • Quickstart
    • Importing content
    • GitHub & GitLab Sync
      • Enabling GitHub Sync
      • Enabling GitLab Sync
      • Content configuration
      • GitHub pull request preview
      • Commit messages & Autolink
      • Monorepos
      • Troubleshooting
  • Creating Content
    • Formatting your content
      • Inline content
      • Markdown
    • Content structure
      • Spaces
      • Pages
      • Collections
    • Blocks
      • Paragraphs
      • Headings
      • Unordered lists
      • Ordered lists
      • Task lists
      • Hints
      • Quotes
      • Code blocks
      • Files
      • Images
      • Embedded URLs
      • Tables
      • Cards
      • Tabs
      • Expandable
      • Stepper
      • Drawings
      • Math & TeX
      • Page links
    • Reusable content
    • Broken links
    • Searching content
      • Search & Quick find
      • GitBook AI
    • Writing with GitBook AI
    • Version control
  • API References
    • OpenAPI
      • Add an OpenAPI specification
      • Insert API reference in your docs
    • Guides
      • Structuring your API reference
      • Adding custom code samples
      • Managing API operations
      • Describing enums
      • Integrating with CI/CD
  • Extensions reference
  • Publishing Documentation
    • Publish a docs site
      • Public publishing
      • Private publishing with share links
    • Site structure
      • Content variants
      • Site sections
    • Site customization
      • Icons, colors, and themes
      • Layout and structure
      • Extra configuration
    • Set a custom domain
    • Setting a custom subdirectory
      • Configuring a subdirectory with Cloudflare
      • Configuring a subdirectory with Vercel
    • Site settings
    • Site insights
    • Site redirects
    • Visitor authentication
      • Enabling visitor authentication
      • Setting up Auth0
      • Setting up Azure AD
      • Setting up AWS Cognito
      • Setting up Okta
      • Setting up OIDC
      • Setting up a custom backend
  • LLM-ready docs
  • Collaboration
    • Live edits
    • Change requests
    • PDF export
    • Inviting your team
    • Comments
    • Notifications
  • Integrations
    • Install and manage integrations
    • GitHub Copilot
  • Account management
    • Plans
      • Legacy pricing
      • Sponsored site plan
      • Non-profit plan
      • Billing policy
    • Subscription cancellations
    • Personal settings
    • Organization settings
    • Member management
      • Invite or remove members
      • Roles
      • Teams
      • Permissions and inheritance
    • SSO & SAML
      • SSO Members vs non-SSO
  • Resources
    • GitBook UI
    • Keyboard shortcuts
    • Glossary
Powered by GitBook
LogoLogo

Resources

  • Showcase
  • Enterprise
  • Status

Company

  • Careers
  • Blog
  • Community

Policies

  • Subprocessors
  • Terms of Service
On this page
  • Root
  • ​Structure‌
  • ​Summary‌
  • ​Redirects
  • Troubleshooting

Was this helpful?

Edit on GitHub
  1. Getting Started
  2. GitHub & GitLab Sync

Content configuration

Configure Git Sync with extra functionalities

If you’d like to configure Git Sync further, you can add a .gitbook.yaml file at the root of your repository to tell GitBook how to parse your Git repository.

.gitbook.yaml
root: ./

​structure:
  readme: README.md
  summary: SUMMARY.md​

redirects:
  previous/page: new-folder/page.md

Root

The path to lookup for your documentation defaults to the root directory of the repository. Here’s how you can tell GitBook to look into a ./docs folder:

.gitbook.yaml
root: ./docs/

All other options that specify paths will be relative to this root folder. So if you define root as ./docs/ and then structure.summary as ./product/SUMMARY.md, GitBook will actually look for a file in ./docs/product/SUMMARY.md.‌

​Structure‌

The structure accepts two properties:‌

  • readme: Your documentation’s first page. Its default value is ./README.md

  • summary: Your documentation’s table of contents. Its default value is ./SUMMARY.md

The value of those properties is a path to the corresponding files. The path is relative to the “root” option. For example, here’s how you can tell GitBook to look into a ./product folder for the first page and summary:

.gitbook.yaml
structure:
  readme: ./product/README.md
  summary: ./product/SUMMARY.md

​Summary‌

The summary file is a Markdown file (.md) that should have the following structure:

./SUMMARY.md
‌# Summary​

## Use headings to create page groups like this one​

* [First page’s title](page1/README.md)
    * [Some child page](page1/page1-1.md)
    * [Some other child page](part1/page1-2.md)

* [Second page’s title](page2/README.md)
    * [Some child page](page2/page2-1.md)
    * [Some other child page](part2/page2-2.md)

## A second-page group​

* [Another page](another-page.md)

Providing a custom summary file is optional. By default, GitBook will look for a file named SUMMARY.md in your root folder if specified in your config file, or at the root of the repository otherwise.

If you don’t specify a summary, and GitBook does not find a SUMMARY.md file at the root of your docs, GitBook will infer the table of contents from the folder structure and the Markdown files below.‌

The summary markdown file is a mirror of the table of contents of your GitBook space. So even when no summary file is provided during an initial import, GitBook will create one and/or update it whenever you update your content using the GitBook editor.

Because of this, it’s not possible to reference the same Markdown file twice in your SUMMARY.md file, because this would imply that a single page lives at two different URLs in your GitBook space.

​Redirects

Redirects allow you to define redirects in your .gitbook.yaml configuration file. The path is relative to the “root” option. For example, here’s how you can tell GitBook to redirect users accessing a past url /help to a new url /support

.gitbook.yaml
root: ./

redirects:
  help: support.md

Restructuring your content in GitBook

When moving your content within GitBook, most URLs should work as expected depending on complexity of the change. You can use our Broken Links feature to scan your space to find which links are broken, if any.

With Git, when a file is moved many times, the file is removed and a new one is created. This makes it impossible for GitBook to know that a folder has been renamed, for example. Make sure to double-check and add redirects where needed.

Troubleshooting

When setting redirects, do not add any leading slashes. For example, trying to redirect to ./misc/support.md will not work.

It's also important to consider that as long as a page exists for a path, GitBook won’t be looking for a possible redirect. So if you're setting up a redirect for an old page to a new one, you will need to remove the old page in order for the redirect to work.

Last updated 5 months ago

Was this helpful?

Redirects you define in a space’s configuration file are scoped to the corresponding space. We recommend creating for most cases as they apply to the whole site, across spaces.

The YAML file needs to be correctly formatted for the redirects to work. Errors such as incorrect indentation or whitespace can result in your redirects not working. can ensure that the redirects will work smoothly.

site redirects
Validating your YAML file