Versioned docs (#289)

* Versioned documentation

Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com>

* Versioned docs

Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com>
Co-authored-by: James Humphries <james@james-humphries.co.uk>

* Reverted accidental changes

Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com>

* Reverted accidental changes

Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com>

* Reverted accidental changes

Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com>

* Docusaurus config

Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com>

* 1.7 split

Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com>

* Symlink

Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com>

* Versioned docs finalization

Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com>

---------

Signed-off-by: Janos <86970079+janosdebugs@users.noreply.github.com>
Co-authored-by: James Humphries <james@james-humphries.co.uk>
This commit is contained in:
Janos 2024-04-24 15:53:41 +02:00 committed by GitHub
parent 5d176d739d
commit cf879629aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 85 additions and 99 deletions

14
.gitmodules vendored
View file

@ -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

View file

@ -1,43 +0,0 @@
---
title: Documentation
hide_table_of_contents: true
---
import DocCardList from "@theme/DocCardList";
### Documentation
The documentation is divided into four main sections, covering CLI-based workflows, internal processes, an introduction to the tool's capabilities, and guidance on using the OpenTofu configuration language for managing infrastructure.
<DocCardList
items={[
{
type: "link",
href: "/docs/intro",
label: "Intro",
description:
"OpenTofu is an infrastructure as code tool that lets you build, change, and version cloud and on-prem resources safely and efficiently.",
},
{
type: "link",
href: "/docs/cli",
label: "CLI Documentation",
description:
"Learn OpenTofu's CLI-based workflows. You can use the CLI alone or with cloud backends.",
},
{
type: "link",
href: "/docs/language",
label: "Language",
description:
"Use the OpenTofu configuration language to describe the infrastructure that OpenTofu manages.",
},
{
type: "link",
href: "/docs/internals",
label: "Internals",
description:
"Learn how OpenTofu generates the resource dependency graph and executes other internal processes.",
},
]}
/>

View file

@ -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,
],
],
@ -183,6 +199,7 @@ const config: Config = {
respectPrefersColorScheme: false,
},
docs: {
versionPersistence: "none",
sidebar: {
autoCollapseCategories: true,
},
@ -190,7 +207,7 @@ const config: Config = {
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,
@ -259,27 +276,16 @@ const config: Config = {
position: "left",
items: [
{
type: "doc",
label: "Introduction",
docId: "intro/index",
label: "v1.6.x (current)",
href: "/docs"
},
{
type: "doc",
label: "CLI",
docId: "cli/index",
},
{
type: "doc",
label: "Language",
docId: "language/index",
},
{
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",

@ -1 +0,0 @@
Subproject commit 4007b3255321b0c534f448cc7f7b75cca5b8fda6

1
opentofu-repo/main Submodule

@ -0,0 +1 @@
Subproject commit 0e7ba7120a2f455384a819cf6e7eff4f71676266

1
opentofu-repo/v1.6 Submodule

@ -0,0 +1 @@
Subproject commit 32a3167aee3d8582cccb8838c751ee6fbd8ddc3a

1
opentofu-repo/v1.7 Submodule

@ -0,0 +1 @@
Subproject commit c7ae8635f956274f509872eecb4e483f30874020

View file

@ -1,26 +0,0 @@
module.exports = {
cli: [
{
type: "autogenerated",
dirName: "cli",
},
],
internals: [
{
type: "autogenerated",
dirName: "internals",
},
],
intro: [
{
type: "autogenerated",
dirName: "intro",
},
],
language: [
{
type: "autogenerated",
dirName: "language",
},
],
};

8
sidebars.json Normal file
View file

@ -0,0 +1,8 @@
{
"docs": [
{
"type": "autogenerated",
"dirName": "."
}
]
}

View file

@ -29,7 +29,6 @@ export default function DocItemLayout({ children }: Props) {
<article className="flex flex-col gap-4 mb-10">
<DocBreadcrumbs />
<DocVersionBadge />
{canRenderTOC && <DocItemTOCMobile />}
<DocItemContent>{children}</DocItemContent>
<DocItemFooter />

1
versioned_docs/version-main Symbolic link
View file

@ -0,0 +1 @@
../opentofu-repo/main/website/docs

1
versioned_docs/version-v1.6 Symbolic link
View file

@ -0,0 +1 @@
../opentofu-repo/v1.6/website/docs

1
versioned_docs/version-v1.7 Symbolic link
View file

@ -0,0 +1 @@
../opentofu-repo/v1.7/website/docs

View file

@ -0,0 +1,8 @@
{
"docs": [
{
"type": "autogenerated",
"dirName": "."
}
]
}

View file

@ -0,0 +1,8 @@
{
"docs": [
{
"type": "autogenerated",
"dirName": "."
}
]
}

View file

@ -0,0 +1,8 @@
{
"docs": [
{
"type": "autogenerated",
"dirName": "."
}
]
}

5
versions.json Normal file
View file

@ -0,0 +1,5 @@
[
"v1.7",
"v1.6",
"main"
]