Skip to content

Commit 989db50

Browse files
committed
Revert "Merge pull request bpftrace#3 from jordalgo/redirects"
This reverts commit 5ffacbc, reversing changes made to 60710fb.
1 parent 4cc6e00 commit 989db50

File tree

10 files changed

+7623
-51
lines changed

10 files changed

+7623
-51
lines changed

README.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
# Docs Website
22

3-
All this site does is redirect to bptrace.org until we update the
4-
DNS entry for docs.bpftrace.org to point to https://bpftrace.org/docs
3+
See https://github.com/bpftrace/website for instructions on working with a Docusaurus site.
4+
5+
## Directory Structure
6+
7+
The `docs` directory holds documentation for the in-development, unreleased bpftrace version. It should regularly pull in the docs from the bpftrace source repository.
8+
9+
The `versioned_docs` directory holds snapshots of the docs from each released version. The latest version should be duplicated as both `version-x.y` and `version-latest`, to facilitate permalinks.
10+
11+
## Updating Docs
12+
13+
1. Update the versioned documentation snapshots:
14+
```
15+
rm -rf versioned_docs/version-latest
16+
cp -r docs versioned_docs/version-latest
17+
cp -r docs versioned_docs/version-x.y
18+
```
19+
20+
2. Add the new version to `versions.json`, directly underneath `"latest"`.
21+
3. In `docusaurus.config.js`, update the version number in `config.presets.docs.versions` to refer to the new release.

docusaurus.config.js

+110-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
// See: https://docusaurus.io/docs/api/docusaurus-config
66

77
import {themes as prismThemes} from 'prism-react-renderer';
8+
import versions from './versions.json';
9+
10+
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
11+
12+
function getLatestVersion() {
13+
// versions[0] is "latest", versions[1] will contain the actual version number
14+
// of the latest version
15+
return versions[1];
16+
}
17+
const latestVersion = getLatestVersion();
818

919
/** @type {import('@docusaurus/types').Config} */
1020
const config = {
@@ -38,13 +48,32 @@ const config = {
3848
'classic',
3949
/** @type {import('@docusaurus/preset-classic').Options} */
4050
({
51+
docs: {
52+
routeBasePath: '/',
53+
editUrl: 'https://github.com/bpftrace/bpftrace',
54+
versions: {
55+
current: {
56+
label: 'pre-release',
57+
},
58+
'latest': {
59+
path: 'latest',
60+
label: `latest (${getLatestVersion()})`,
61+
},
62+
'0.22': {
63+
banner: 'none',
64+
},
65+
},
66+
},
4167
blog: false,
4268
theme: {
4369
customCss: './src/css/custom.css',
4470
},
4571
}),
4672
],
4773
],
74+
customFields: {
75+
latestVersion,
76+
},
4877

4978
themeConfig:
5079
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
@@ -58,10 +87,90 @@ const config = {
5887
href: 'https://bpftrace.org',
5988
target: '_self',
6089
},
61-
items: [],
90+
items: [
91+
{
92+
to: 'https://bpftrace.org/learn',
93+
label: 'Learn',
94+
target: '_self',
95+
position: 'left',
96+
},
97+
{
98+
to: `${getLatestVersion()}`,
99+
label: 'Docs',
100+
target: '_self', // open external link in current window
101+
position: 'left',
102+
className: 'navbar__link--active',
103+
},
104+
{
105+
to: 'https://bpftrace.org/blog',
106+
label: 'Blog',
107+
target: '_self',
108+
position: 'left',
109+
},
110+
{
111+
href: 'https://github.com/bpftrace/bpftrace/discussions',
112+
label: 'Discussions',
113+
target: '_self',
114+
position: 'left',
115+
},
116+
{
117+
type: 'docsVersionDropdown',
118+
position: 'right',
119+
},
120+
{
121+
href: 'https://github.com/bpftrace/bpftrace',
122+
label: 'GitHub',
123+
position: 'right',
124+
},
125+
],
62126
},
63127
footer: {
64128
style: 'dark',
129+
links: [
130+
{
131+
title: 'Docs + Tutorials',
132+
items: [
133+
{
134+
label: 'Documentation',
135+
to: `${getLatestVersion()}`,
136+
target: '_self',
137+
},
138+
{
139+
label: 'One-Liner Introduction Tutorial',
140+
to: 'https://bpftrace.org/tutorial-one-liners',
141+
target: '_self',
142+
},
143+
],
144+
},
145+
{
146+
title: 'Community',
147+
items: [
148+
{
149+
label: 'IRC',
150+
href: 'https://webchat.oftc.net/?nick=&channels=%23bpftrace',
151+
},
152+
{
153+
label: 'Talks',
154+
href: 'https://bpftrace.org/videos',
155+
target: '_self',
156+
},
157+
],
158+
},
159+
{
160+
title: 'More',
161+
items: [
162+
{
163+
label: 'Blog',
164+
to: 'https://bpftrace.org/blog',
165+
target: '_self',
166+
},
167+
{
168+
label: 'GitHub',
169+
href: 'https://github.com/bpftrace/bpftrace',
170+
},
171+
],
172+
},
173+
],
65174
copyright: `Copyright © 2019 Alastair Robertson.`,
66175
},
67176
prism: {

src/pages/index.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import clsx from 'clsx';
2+
import Link from '@docusaurus/Link';
3+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
4+
import Layout from '@theme/Layout';
5+
import HomepageFeatures from '@site/src/components/HomepageFeatures';
6+
import useBaseUrl from '@docusaurus/useBaseUrl';
7+
8+
import Heading from '@theme/Heading';
9+
import styles from './index.module.css';
10+
11+
12+
function HomepageHeader() {
13+
const {siteConfig} = useDocusaurusContext();
14+
const latestVersion = useDocusaurusContext().siteConfig.customFields.latestVersion;
15+
return (
16+
<header className={clsx('hero hero--primary', styles.heroBanner)}>
17+
<div className="container">
18+
<h1 className="hero__title">{siteConfig.title}</h1>
19+
<Link to={`${latestVersion}`}>
20+
<button class="button button--secondary button--lg">
21+
View documentation for the latest release ({latestVersion})
22+
</button>
23+
</Link>
24+
</div>
25+
</header>
26+
);
27+
}
28+
29+
export default function Home() {
30+
const {siteConfig} = useDocusaurusContext();
31+
return (
32+
<Layout
33+
title={`${siteConfig.title}: dynamic tracing for the Linux platform`}
34+
description="Description will go into a meta tag in <head />">
35+
<HomepageHeader />
36+
</Layout>
37+
);
38+
}

static/0.22

-12
This file was deleted.

static/index.html

-12
This file was deleted.

static/latest

-12
This file was deleted.

static/next

-12
This file was deleted.

0 commit comments

Comments
 (0)