-
Notifications
You must be signed in to change notification settings - Fork 7
docs: document git-ref-based docs versioning #6558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+43
−1
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
410cdc7
docs: document git-ref-based docs versioning
Ryan-Amirthan 4fd1354
docs: simplify git ref build description
Ryan-Amirthan f5e054e
docs: use 'frozen versions' instead of 'snapshot versioning'
Ryan-Amirthan 305a279
docs: describe ref content root in user terms
Ryan-Amirthan 67d6c50
docs: add branch ref example; drop path/ref exclusivity note
Ryan-Amirthan e87a1e3
docs: trim shallow-checkout and library-output details
Ryan-Amirthan 6f83a80
docs: replace 'frozen versions' with plain description
devalog baf09e2
reorganize content a bit
devalog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ## Build a docs version from a git ref | ||
|
|
||
| <ChangelogTags>navigation, docs.yml</ChangelogTags> | ||
|
|
||
| You can now point a version entry at a git `ref` (a branch, tag, or commit SHA) instead of a `path` in your working tree. On publish, Fern builds that version's content from the ref, composed with the current branch's theme and shell. Use it for a version that no longer receives content updates, such as a past release; keep actively maintained versions on `path`, since `fern docs dev` previews working-tree versions only. | ||
|
|
||
| ```yaml docs.yml {5} | ||
| versions: | ||
| - display-name: Latest | ||
| path: ./versions/latest.yml | ||
| - display-name: v2 | ||
| ref: v2.0.0 | ||
| availability: deprecated | ||
| ``` | ||
|
|
||
| <Button intent="none" outlined rightIcon="arrow-right" href="/learn/docs/configuration/versions#build-a-version-from-a-git-ref">Read the docs</Button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,6 +61,8 @@ versions: | |
| ``` | ||
| </CodeBlock> | ||
|
|
||
| `path` points at a version file in your working tree. A version whose content lives at a git [branch, tag, or commit](#build-a-version-from-a-git-ref) can name a `ref` instead. | ||
|
|
||
| <Markdown src="/products/docs/snippets/default-version.mdx" /> | ||
|
|
||
| </Step> | ||
|
|
@@ -89,9 +91,33 @@ If your `docs.yml` file includes a `navigation` field or a `tabs` field, be sure | |
|
|
||
| ## Customize version behavior | ||
|
|
||
| These optional settings let you control how versions appear in URLs and who can access them. | ||
| These optional settings let you control where each version's content comes from, how versions appear in URLs, and who can access them. | ||
|
|
||
| <AccordionGroup> | ||
| <Accordion title="Build a version from a git ref" toc={true}> | ||
|
|
||
| Instead of a `path` into your working tree, a version entry can name a `ref`: a git branch, tag, or commit SHA. On publish, Fern resolves the ref to a commit, checks out the repository at that commit, and builds that version's content from it, composed with the current branch's theme, shell, and `versions` metadata. | ||
|
|
||
| <CodeBlock title="docs.yml"> | ||
| ```yaml {5,8} | ||
| versions: | ||
| - display-name: Latest | ||
| path: ./versions/latest.yml # built from the working tree | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| - display-name: v2 | ||
| ref: release/v2 # built from the branch release/v2 | ||
| - display-name: v1 | ||
| ref: v1.0.0 # built from the tag v1.0.0 | ||
| availability: deprecated | ||
| ``` | ||
| </CodeBlock> | ||
|
|
||
| Use a `ref` for a version of your docs that no longer receives content updates, such as a past release. Keep actively maintained versions on `path` in your working tree. `fern docs dev` previews working-tree versions only, so ref-backed content can't be previewed or edited locally: changing it means committing to the ref (or cutting a new tag) and republishing. | ||
|
|
||
| Tags and commit SHAs are immutable, so a published version stays byte-for-byte stable. Branch refs resolve to whatever commit the remote branch points at when you publish, which means a republish can change already-published content. | ||
|
|
||
| If the ref's own `docs.yml` is versioned, Fern builds its default version and ignores the rest; otherwise it builds the ref's top-level `navigation`. Publishing a ref-backed version requires git and access to the remote. | ||
|
|
||
| </Accordion> | ||
| <Accordion title="Change version slugs" toc={true}> | ||
|
|
||
| By default, Fern generates URL slugs from the `display-name` by converting it to lowercase and replacing spaces with hyphens. For example, a version with `display-name: v3 (Deprecated)` would get the slug `v-3-deprecated` in the URL path. | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[FernStyles.Current] Avoid time-relative terms like 'Latest' that become outdated