Skip to content
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

Versioned docs #289

Merged
9 commits merged into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
[submodule "opentofu-repo"]
path = opentofu-repo
[submodule "opentofu-repo/main"]
path = opentofu-repo/main
url = https://github.com/opentofu/opentofu
branch = v1.6
branch = main
[submodule "opentofu-repo/v1.6"]
path = opentofu-repo/v1.6
url = https://github.com/opentofu/opentofu
branch = v1.6
[submodule "opentofu-repo/v1.7"]
path = opentofu-repo/v1.7
url = https://github.com/opentofu/opentofu
branch = v1.7
43 changes: 0 additions & 43 deletions docs/index.mdx

This file was deleted.

56 changes: 31 additions & 25 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,39 @@ const config: Config = {
customCss: [require.resolve("./src/css/custom.css")],
},
docs: {
sidebarPath: require.resolve("./sidebars.js"),
path: "opentofu-repo/website/docs",
includeCurrentVersion: false,
lastVersion: 'v1.6',
docVersionRootComponent: "@theme/DocVersionRoot",
versions: {
"v1.6": {
label: "1.6.x",
path: ""
},
"v1.7": {
label: "1.7.x",
path: "next",
banner: "unreleased",
noIndex: true
}/*,
"main": {
label: "1.8.x",
path: "next",
banner: "unreleased",
noIndex: true
}*/
},
routeBasePath: "/docs",
editUrl: ({ docPath }) => {
editUrl: ({ version, docPath }) => {
// Remove the edit link from the documentation index page
// TODO: remove after moving the page to the main OpenTofu repo
if (docPath === "index.mdx") {
return `https://github.com/opentofu/opentofu.org/edit/main/docs/${docPath}`;
return `https://github.com/opentofu/opentofu.org/edit/${version}/docs/${docPath}`;
}

return `https://github.com/opentofu/opentofu/edit/main/website/docs/${docPath}`;
return `https://github.com/opentofu/opentofu/edit/${version}/website/docs/${docPath}`;
},
},
blog: false,
gtag: {
trackingID: "G-NKLFR0FNQZ",
},
} satisfies Preset.Options,
],
],
Expand Down Expand Up @@ -183,14 +199,15 @@ const config: Config = {
respectPrefersColorScheme: false,
},
docs: {
versionPersistence: "none",
sidebar: {
autoCollapseCategories: true,
},
},
announcementBar: {
id: "opentofu-ga",
content:
'OpenTofu 1.7.0-beta1 is now availabe &mdash; <a target="_blank" rel="noopener noreferrer" href="/blog/opentofu-1-7-0-beta1/">learn more</a>.',
'OpenTofu 1.7.0-rc1 is now availabe &mdash; <a target="_blank" rel="noopener noreferrer" href="https://github.com/opentofu/opentofu/releases/tag/v1.7.0-rc1">learn more</a>.',
backgroundColor: "#ffda18",
textColor: "#1b1d20",
isCloseable: false,
Expand Down Expand Up @@ -259,27 +276,16 @@ const config: Config = {
position: "left",
items: [
{
type: "doc",
label: "Introduction",
docId: "intro/index",
},
{
type: "doc",
label: "CLI",
docId: "cli/index",
},
{
type: "doc",
label: "Language",
docId: "language/index",
label: "v1.6.x (current)",
href: "/docs"
},
{
type: "doc",
label: "Internals",
docId: "internals/index",
label: "v1.7.x (next)",
href: "/docs/next"
},
],
},

// TODO: This link is important but there's no design for it yet
// {
// type: "dropdown",
Expand Down
1 change: 0 additions & 1 deletion opentofu-repo
Submodule opentofu-repo deleted from 4007b3
1 change: 1 addition & 0 deletions opentofu-repo/main
Submodule main added at 0e7ba7
1 change: 1 addition & 0 deletions opentofu-repo/v1.6
Submodule v1.6 added at 32a316
1 change: 1 addition & 0 deletions opentofu-repo/v1.7
Submodule v1.7 added at c7ae86
26 changes: 0 additions & 26 deletions sidebars.js

This file was deleted.

8 changes: 8 additions & 0 deletions sidebars.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"docs": [
{
"type": "autogenerated",
"dirName": "."
}
]
}
1 change: 0 additions & 1 deletion src/theme/DocItem/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { useDoc } from "@docusaurus/theme-common/internal";
import DocItemPaginator from "@theme/DocItem/Paginator";
import DocVersionBanner from "@theme/DocVersionBanner";
import DocVersionBadge from "@theme/DocVersionBadge";

Check failure on line 5 in src/theme/DocItem/Layout.tsx

View workflow job for this annotation

GitHub Actions / deploy

'DocVersionBadge' is defined but never used
import DocItemFooter from "@theme/DocItem/Footer";
import DocItemTOCMobile from "@theme/DocItem/TOC/Mobile";
import DocItemTOCDesktop from "@theme/DocItem/TOC/Desktop";
Expand All @@ -29,7 +29,6 @@

<article className="flex flex-col gap-4 mb-10">
<DocBreadcrumbs />
<DocVersionBadge />
{canRenderTOC && <DocItemTOCMobile />}
<DocItemContent>{children}</DocItemContent>
<DocItemFooter />
Expand Down
1 change: 1 addition & 0 deletions versioned_docs/version-main
1 change: 1 addition & 0 deletions versioned_docs/version-v1.6
1 change: 1 addition & 0 deletions versioned_docs/version-v1.7
8 changes: 8 additions & 0 deletions versioned_sidebars/version-main-sidebars.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"docs": [
{
"type": "autogenerated",
"dirName": "."
}
]
}
8 changes: 8 additions & 0 deletions versioned_sidebars/version-v1.6-sidebars.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"docs": [
{
"type": "autogenerated",
"dirName": "."
}
]
}
8 changes: 8 additions & 0 deletions versioned_sidebars/version-v1.7-sidebars.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"docs": [
{
"type": "autogenerated",
"dirName": "."
}
]
}
5 changes: 5 additions & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
"v1.7",
"v1.6",
"main"
]
Loading