Skip to content

Commit

Permalink
Merge pull request #226 from nextstrain/migrate-docs
Browse files Browse the repository at this point in the history
Redirect /docs and /help to docs.nextstrain.org
  • Loading branch information
jameshadfield authored Nov 12, 2020
2 parents 35bd918 + 3c77573 commit d9df53e
Show file tree
Hide file tree
Showing 50 changed files with 110 additions and 2,062 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,20 @@ You'll need AWS credentials configured (via environment or `~/.aws/credentials`)
If you add a new profile to `~/.aws/credentials`, you can then tell the local nextstrain.org server to use it by setting `AWS_PROFILE=...`.

---
## Splash & documentation pages
These are found in `./static-site/`.
See [static-site/README.md](./static-site/README.md) for instructions on how to add content (e.g. docs) and develop this portion of the site in isolation.
In production, this is built using Gatsby (`npm run build`) and served via the nextstrain.org server (`npm run server`).

## Splash page (and other misc pages)
There are a number of pages built using Gatsby and found in `./static-site/`.
See [static-site/README.md](./static-site/README.md) for instructions on how to add content and develop this portion of the site in isolation.
In production, these are compiled (`npm run build`) and served via the nextstrain.org server (`npm run server`).

---
## Documentation

Nextstrain documentation is hosted by Read The Docs at [docs.nextstrain.org](https://docs.nextstrain.org).
Please see [this GitHub repo](https://github.com/nextstrain/docs.nextstrain.org/) for more details.

> Note that the documentation used to be served from the server in this repo at URLs such as nextstain.org/docs/... until [November 2020](https://github.com/nextstrain/nextstrain.org/pull/226).
A number of [redirects](./redirects.js) have been added to preserve old URLs.

---
## Auspice client
Expand Down
14 changes: 7 additions & 7 deletions auspice-client/customisations/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ const getStyles = ({minified=true, width}={}) => ({
}
});

const renderLink = (text, url, style) => (
<a key={text} style={style} href={url}>
{text}
const Link = (props) => (
<a key={props.text} href={props.href} style={props.style} target={props.target} rel={props.rel}>
{props.text}
</a>
);

Expand Down Expand Up @@ -92,8 +92,8 @@ class WhoAmI extends React.Component {
return (
<div>
{ this.state.user
? renderLink(`👤 ${this.state.user.username}`, "/whoami", styles.link)
: renderLink("LOGIN", "/login", styles.link) }
? <Link text={`👤 ${this.state.user.username}`} href="/whoami" style={styles.link}/>
: <Link text="LOGIN" href="/login" style={styles.link}/> }
</div>
);
}
Expand Down Expand Up @@ -123,8 +123,8 @@ const NavBar = ({sidebar, narrativeTitle, width}) => {
null : (
<div style={{...styles.flexColumns, paddingRight: "12px"}}>
<div style={{flex: 5}}/>
{renderLink("DOCS", "/docs", styles.link)}
{renderLink("HELP", "/help", styles.link)}
<Link href="https://docs.nextstrain.org/en/latest/index.html" style={styles.link} text="DOCS"/>
<Link href="https://docs.nextstrain.org/en/latest/learn/about-nextstrain.html" style={styles.link} text="HELP"/>
<WhoAmI sidebar={sidebar}/>
</div>
)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"passport": "^0.4.0",
"passport-oauth2": "^1.5.0",
"query-string": "^4.2.3",
"react-icons": "^3.11.0",
"request": "^2.88.0",
"serve-favicon": "^2.5.0",
"session-file-store": "^1.3.1",
Expand Down
70 changes: 68 additions & 2 deletions redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const { parseNarrativeLanguage } = require("./src/utils");

const setup = (app) => {

/* send auspice to the auspice docs (currently hosted as github pages) */
/* send auspice to the auspice docs (currently hosted on docs.nextstrain.org) */
app.route("/auspice")
.get((req, res) => res.redirect('https://nextstrain.github.io/auspice/'));
.get((req, res) => res.redirect('https://docs.nextstrain.org/projects/auspice/en/latest/'));

/* we don't yet have a community page */
app.route("/community")
Expand Down Expand Up @@ -52,6 +52,72 @@ const setup = (app) => {
conflates a language part ("zh") with a region ("europe") so we want to keep zh out of the manifest JSON */
app.route("/ncov/zh").get((req, res) => res.redirect("/ncov/global/zh"));

/**
* DOCS & HELP Redirects
* In November 2020 we shifted the docs from being hosted by this server
* at nextstrain.org/docs and nextstrain.org/help
* to a Read The Docs setup running at docs.nextstrain.org.
* This block contains the appropriate redirects
*/
const mainReadTheDocs = "https://docs.nextstrain.org/en/latest";
const augurReadTheDocs = "https://docs.nextstrain.org/projects/augur/en/latest";
const docsRedirects = {
"/docs": `${mainReadTheDocs}`,
"/help": `${mainReadTheDocs}/learn/about-nextstrain.html`,
"/docs/getting-started/introduction": `${mainReadTheDocs}/learn/about-nextstrain.html`,
"/about": `${mainReadTheDocs}/learn/about-nextstrain.html`,
"/about/overview/introduction": `${mainReadTheDocs}/learn/about-nextstrain.html`,
"/about/overview": `${mainReadTheDocs}/learn/about-nextstrain.html`,
"/about/methods/introduction": `${mainReadTheDocs}/learn/about-nextstrain.html`,
"/about/methods": `${mainReadTheDocs}/learn/about-nextstrain.html`,
"/docs/getting-started/local-installation": `${mainReadTheDocs}/guides/install/local-installation.html`,
"/docs/getting-started/installation": `${mainReadTheDocs}/guides/install/local-installation.html`,
"/docs/getting-started/local-vs-container-install": `${mainReadTheDocs}/guides/install/index.html`,
"/docs/getting-started/container-installation": `${mainReadTheDocs}/guides/install/cli-install.html`,
"/docs/getting-started/quickstart": `${mainReadTheDocs}/tutorials/quickstart.html`,
"/docs/getting-started/windows-help": `${mainReadTheDocs}/guides/install/windows-help.html`,
"/docs/bioinformatics/introduction-to-augur": `${augurReadTheDocs}/index.html`,
"/docs/bioinformatics/introduction": `${augurReadTheDocs}/faq/index.html`,
"/docs/bioinformatics/what-is-a-build": `${augurReadTheDocs}/faq/what-is-a-build.html`,
"/docs/bioinformatics/data-formats": `${mainReadTheDocs}/reference/formats/data-formats.html`,
"/docs/bioinformatics/output-jsons": `${mainReadTheDocs}/reference/formats/data-formats.html`,
"/docs/bioinformatics/augur-commands": `${augurReadTheDocs}/usage/cli/cli.html`,
"/docs/bioinformatics/customizing-a-build": `${mainReadTheDocs}/guides/bioinformatics/index.html`,
"/docs/tutorials/defining-clades": `${mainReadTheDocs}/guides/bioinformatics/defining-clades.html`,
"/docs/tutorials/zika": `${mainReadTheDocs}/tutorials/zika.html`,
"/docs/getting-started/zika-tutorial": `${mainReadTheDocs}/tutorials/zika.html`,
"/docs/tutorials/tb": `${mainReadTheDocs}/tutorials/tb_tutorial.html`,
"/docs/getting-started/tb-tutorial": `${mainReadTheDocs}/tutorials/tb_tutorial.html`,
"/docs/contributing/community-builds": `${mainReadTheDocs}/guides/share/community-builds.html`,
"/docs/contributing/documentation": `${mainReadTheDocs}/guides/contribute/documentation.html`,
"/docs/contributing/development": `${mainReadTheDocs}/guides/contribute/index.html`,
"/docs/contributing/fetch-data-from-custom-urls": `${mainReadTheDocs}/guides/share/fetch-via-urls.html`,
"/fetch": `${mainReadTheDocs}/guides/share/fetch-via-urls.html`,
"/docs/contributing/nextstrain-groups": `${mainReadTheDocs}/guides/share/nextstrain-groups.html`,
"/docs/contributing/sharing-data": `${mainReadTheDocs}/guides/share/index.html`,
"/docs/contributing/philosophy": `${mainReadTheDocs}/guides/share/index.html`,
"/docs/visualisation/download-data": `${mainReadTheDocs}/guides/share/download-data.html`,
"/docs/visualisation/map-interpretation": `${mainReadTheDocs}/learn/interpret/map-interpretation.html`,
"/docs/visualisation/narratives": `${mainReadTheDocs}/guides/communicate/narratives-intro.html`,
"/docs/narratives/introduction": `${mainReadTheDocs}/guides/communicate/narratives-intro.html`,
"/help/general/about-nextstrain": `${mainReadTheDocs}/learn/about-nextstrain.html`,
"/help/general/how-to-read-a-tree": `${mainReadTheDocs}/learn/interpret/how-to-read-a-tree.html`,
"/help/general/interacting-with-nextstrain": `${mainReadTheDocs}/learn/interpret/interacting-with-nextstrain.html`,
"/docs/interpretation": `${mainReadTheDocs}/learn/interpret/index.html`,
"/docs/interpretation/auspice": `${mainReadTheDocs}/learn/interpret/index.html`,
"/docs/visualisation": `${mainReadTheDocs}/learn/interpret/index.html`,
"/docs/visualisation/introduction": `${mainReadTheDocs}/learn/interpret/index.html`,
"/help/coronavirus/FAQ": `${mainReadTheDocs}/learn/pathogens/coronavirus/FAQ.html`,
"/help/coronavirus/SARS-CoV-2": `${mainReadTheDocs}/learn/pathogens/coronavirus/SARS-CoV-2.html`,
"/help/coronavirus/Technical-FAQ": `${mainReadTheDocs}/learn/pathogens/coronavirus/Technical-FAQ.html`,
"/help/coronavirus/human-CoV": `${mainReadTheDocs}/learn/pathogens/coronavirus/human-CoV.html`
};

for (const [from, to] of Object.entries(docsRedirects)) {
app.route([from])
.get((req, res) => res.redirect(to));
}

};

module.exports = {
Expand Down
47 changes: 7 additions & 40 deletions static-site/additional_sidebar_entries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,10 @@
# (for me) to do it on the react side as that's where i'm more
# comfortable.
# james, June 2020.
- section: "docs"
chapter: "getting-started"
name: "Container Installation"
url: "https://docs.nextstrain.org/projects/cli/en/latest/installation/"
- section: "docs"
chapter: "tutorials"
name: "Analysing MTb (VCF) data"
url: "https://docs.nextstrain.org/projects/augur/en/stable/tutorials/tb_tutorial.html"
- section: "docs"
chapter: "tutorials"
name: "Analysing SARS-CoV-2 data"
url: "https://nextstrain.github.io/ncov/"
- section: "docs"
chapter: "bioinformatics"
name: "Augur Commands"
url: "https://docs.nextstrain.org/projects/augur/en/stable/usage/cli/cli.html"
- section: "docs"
chapter: "bioinformatics"
name: "Frequently Asked Questions"
url: "https://docs.nextstrain.org/projects/augur/en/stable/faq/faq.html"
- section: "docs"
chapter: "tutorials"
name: "Writing a Narrative"
url: "https://nextstrain.github.io/auspice/narratives/how-to-write"
- section: "docs"
chapter: "contributing"
name: "Development"
url: "https://github.com/nextstrain/.github/blob/master/CONTRIBUTING.md"
- section: "docs"
chapter: "visualisation"
name: "Interactive Narratives"
url: "https://nextstrain.github.io/auspice/narratives/introduction"
- section: "docs"
chapter: "visualisation"
name: "Drag & Drop Metadata"
url: "https://nextstrain.github.io/auspice/advanced-functionality/drag-drop-csv-tsv"
- section: "docs"
chapter: "visualisation"
name: "Display Multiple Trees"
url: "https://nextstrain.github.io/auspice/advanced-functionality/second-trees"
# After migrating all docs to docs.nextstrain.org, we no longer use this.
# eli, October 2020.
# Here is what it would look like if you wanted to add an external link sidebar entry using this file:
# - section: "docs"
# chapter: "getting-started"
# name: "Container Installation"
# url: "https://docs.nextstrain.org/projects/cli/en/latest/installation/"
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The only complicated aspect is deciding whether to serve auspice or Gatsby files

**The static site:** can be found [here](https://github.com/nextstrain/static) and is build using [Gatsby](https://www.gatsbyjs.org/).
This comprises the splash page and documentation (docs, about, blogs etc) all build from markdown files.
[This page](/docs/static-content/introduction) explains the structure of the static page and shows how to add content – it's really easy ;).
[This page](https://github.com/nextstrain/nextstrain.org/tree/master/static-site#nextstrain-static-site) explains the structure of the static page and shows how to add content – it's really easy ;).


**Auspice:** is the visualisation app, build as a single page javascript application ([github](https://github.com/nextstrain/auspice)).
Expand Down
1 change: 1 addition & 0 deletions static-site/content/blog/2019-10-21-auspice-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
author: "James Hadfield"
date: "2019-10-21"
title: "Auspice v2 released"
anchorText: "Auspice v2"
---

## What's New
Expand Down
87 changes: 0 additions & 87 deletions static-site/content/docs/01-getting-started/01-introduction.md

This file was deleted.

Loading

0 comments on commit d9df53e

Please sign in to comment.