Skip to content
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
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# Docs Website

All this site does is redirect to bptrace.org until we update the
DNS entry for docs.bpftrace.org to point to https://bpftrace.org/docs
See https://github.com/bpftrace/website for instructions on working with a Docusaurus site.

## Directory Structure

The `docs` directory holds documentation for the in-development, unreleased bpftrace version. It should regularly pull in the docs from the bpftrace source repository.

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.

## Updating Docs

1. Update the versioned documentation snapshots:
```
rm -rf versioned_docs/version-latest
cp -r docs versioned_docs/version-latest
cp -r docs versioned_docs/version-x.y
```

2. Add the new version to `versions.json`, directly underneath `"latest"`.
3. In `docusaurus.config.js`, update the version number in `config.presets.docs.versions` to refer to the new release.
111 changes: 110 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
// See: https://docusaurus.io/docs/api/docusaurus-config

import {themes as prismThemes} from 'prism-react-renderer';
import versions from './versions.json';

// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)

function getLatestVersion() {
// versions[0] is "latest", versions[1] will contain the actual version number
// of the latest version
return versions[1];
}
const latestVersion = getLatestVersion();

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand Down Expand Up @@ -38,13 +48,32 @@ const config = {
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
routeBasePath: '/',
editUrl: 'https://github.com/bpftrace/bpftrace',
versions: {
current: {
label: 'pre-release',
},
'latest': {
path: 'latest',
label: `latest (${getLatestVersion()})`,
},
'0.22': {
banner: 'none',
},
},
},
blog: false,
theme: {
customCss: './src/css/custom.css',
},
}),
],
],
customFields: {
latestVersion,
},

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
Expand All @@ -58,10 +87,90 @@ const config = {
href: 'https://bpftrace.org',
target: '_self',
},
items: [],
items: [
{
to: 'https://bpftrace.org/learn',
label: 'Learn',
target: '_self',
position: 'left',
},
{
to: `${getLatestVersion()}`,
label: 'Docs',
target: '_self', // open external link in current window
position: 'left',
className: 'navbar__link--active',
},
{
to: 'https://bpftrace.org/blog',
label: 'Blog',
target: '_self',
position: 'left',
},
{
href: 'https://github.com/bpftrace/bpftrace/discussions',
label: 'Discussions',
target: '_self',
position: 'left',
},
{
type: 'docsVersionDropdown',
position: 'right',
},
{
href: 'https://github.com/bpftrace/bpftrace',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs + Tutorials',
items: [
{
label: 'Documentation',
to: `${getLatestVersion()}`,
target: '_self',
},
{
label: 'One-Liner Introduction Tutorial',
to: 'https://bpftrace.org/tutorial-one-liners',
target: '_self',
},
],
},
{
title: 'Community',
items: [
{
label: 'IRC',
href: 'https://webchat.oftc.net/?nick=&channels=%23bpftrace',
},
{
label: 'Talks',
href: 'https://bpftrace.org/videos',
target: '_self',
},
],
},
{
title: 'More',
items: [
{
label: 'Blog',
to: 'https://bpftrace.org/blog',
target: '_self',
},
{
label: 'GitHub',
href: 'https://github.com/bpftrace/bpftrace',
},
],
},
],
copyright: `Copyright © 2019 Alastair Robertson.`,
},
prism: {
Expand Down
38 changes: 38 additions & 0 deletions src/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import clsx from 'clsx';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout';
import HomepageFeatures from '@site/src/components/HomepageFeatures';
import useBaseUrl from '@docusaurus/useBaseUrl';

import Heading from '@theme/Heading';
import styles from './index.module.css';


function HomepageHeader() {
const {siteConfig} = useDocusaurusContext();
const latestVersion = useDocusaurusContext().siteConfig.customFields.latestVersion;
return (
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
<h1 className="hero__title">{siteConfig.title}</h1>
<Link to={`${latestVersion}`}>
<button class="button button--secondary button--lg">
View documentation for the latest release ({latestVersion})
</button>
</Link>
</div>
</header>
);
}

export default function Home() {
const {siteConfig} = useDocusaurusContext();
return (
<Layout
title={`${siteConfig.title}: dynamic tracing for the Linux platform`}
description="Description will go into a meta tag in <head />">
<HomepageHeader />
</Layout>
);
}
12 changes: 0 additions & 12 deletions static/0.22

This file was deleted.

11 changes: 0 additions & 11 deletions static/index.html

This file was deleted.

11 changes: 0 additions & 11 deletions static/latest

This file was deleted.

11 changes: 0 additions & 11 deletions static/next

This file was deleted.

Loading
Loading