Skip to content

Commit

Permalink
[docs] add README and docs versioning
Browse files Browse the repository at this point in the history
Signed-off-by: flynnduism <dev@ronan.design>
  • Loading branch information
flynnduism committed Nov 5, 2020
1 parent 445ba11 commit 981ce58
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 7 deletions.
94 changes: 94 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
A documentation website for the [OSM](https://github.com/openservicemesh/osm/) project - [docs.openservicemesh.io](https://docs.openservicemesh.io)

# Editing Content

docs.openservicemesh.io is a static site. The documentation content needs to be located at `docs/content/docs/`.

To ensure the docs content renders correctly in the theme, each page will need to have [front matter](https://gohugo.io/content-management/front-matter/) metadata. Example front matter:

```
---
title: "Docs Home"
linkTitle: "Home"
description: "OSM Docs Home"
weight: 1
type: docs
---
```

## Front Matter Notes:

* inclusion of `type: docs` is important for the theme to properly index the site contents
* the `linkTitle` attribute allows you to simplify the name as it appears in the left-side nav bar - ideally it should be short and clear - whereas the title can handle longform names for pages/documents.

## Versioning the Docs Site

When a new OSM release is cut, the docs site should be updated to reflect the version change. The underlying Docsy theme has versioning support built-in.

<img width="244" alt="Screen Shot 2020-10-27 at 11 25 23 AM" src="https://user-images.githubusercontent.com/686194/97345732-a979ab80-1847-11eb-8c42-1b52c422a722.png">

## Release and Versioning Process:

1. Create an archive of the current `main` branch, following the naming convention used by [prior releases](https://github.com/openservicemesh/osm/branches). Push this archival branch to `upstream`.

<img width="301" alt="Screen Shot 2020-10-27 at 11 11 17 AM" src="https://user-images.githubusercontent.com/686194/97343954-5999e500-1845-11eb-96f4-d9d59352a830.png">

2. Once a release version branch is pushed to `upstream`, Netlify will build and deploy the documentation found within that branch. Within a couple of minutes of the branch push, the version of the site should be accessible at `https://<BRANCHNAME>--osm-docs.netlify.app/`

Test the url for the branch once deployed to ensure it is working.

3. Update the site version menu to reflect the changes

<img width="723" alt="Screen Shot 2020-10-27 at 11 36 02 AM" src="https://user-images.githubusercontent.com/686194/97346387-9ca98780-1848-11eb-8179-523dcbed79c0.png">

The version dropdown menu in set in the sites' `config.toml` (L73) file - adding a new `params.versions` archival entry for the prior release/branch, using the url from Netlify. The current release at the top of the list should reflect (i) the new version and (ii) the primary docs website url.

Example _(where v5 is new and v4 is now an archival prior release):_

```
[[params.versions]]
version = "v0.5"
url = "https://docs.openservicemesh.io"
[[params.versions]]
version = "v0.4"
url = "https://release-v0.4--osm-docs.netlify.app"
```

See [the Doscy versioning docs](https://www.docsy.dev/docs/adding-content/versioning/) for more information on these theme config parameters.

> Note: the versioning controls are forward-facing only due to the nature of git branch history. The documentation website and netlify build process was added after `release-v0.4`, so only future releases will be deployed in this manner. The first release to be properly archived in this way will be `release-v0.5`. Trying to access archival urls for earlier versions (0.1 to 0.4) will not work because they predate this documentation website.


# Site Development

## Notes

* built with the [Hugo](https://gohugo.io/) static site generator
* custom theme uses [Docsy](https://www.docsy.dev/) as a base, with [Bootstrap](https://getbootstrap.com/) as the underlying css framework and some [OSM custom sass](https://github.com/openservicemesh/osm/pull/1840/files#diff-374e78d353e95d66afe7e6c3e13de4aab370ffb117f32aeac519b15c2cbd057aR1)
* deployed to [Netlify](https://app.netlify.com/sites/osm-docs/deploys) via merges to master. (@flynnduism can grant additional access to account)
* metrics tracked via Google Analytics

## Install dependencies:

* Hugo [installation guide](https://gohugo.io/getting-started/installing/)
* packages are installed by running `yarn`

## Run the site:

```
// rebuild the site (to compile latest css/js)
hugo
// or serve the site for local dev
hugo serve
```

## Deploying the site:

The site auto deploys the master branch via [Netlify](https://app.netlify.com/sites/osm-docs). Once pull requests are merged the changes will appear at docs.openservicemesh.io after a couple of minutes. Check the [logs](https://app.netlify.com/sites/osm-docs/deploys) for details.

[![Netlify Status](https://api.netlify.com/api/v1/badges/8c8b7b52-b87f-42e0-949a-a784c3ca6d9a/deploy-status)](https://app.netlify.com/sites/osm-docs/deploys)

`hugo serve` will run the site locally at [localhost:1313](http://localhost:1313/)
39 changes: 36 additions & 3 deletions docs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ enableRobotsTXT = true

# Will give values to .Lastmod etc.
enableGitInfo = true

# Language settings
contentDir = "content/en"
contentDir = "content"
version_menu = "Releases"
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = false
# Useful when translating.
Expand Down Expand Up @@ -77,6 +76,40 @@ time_format_blog = "02.01.2006"

# Everything below this are Site Params

# OSM top menu (should match main site)
[[menu.main]]
name = "Home"
weight = 10
url = "https://openservicemesh.io"
[[menu.main]]
name = "Docs"
weight = 20
url = "/docs"
[[menu.main]]
name = "Github"
weight = 30
url = "https://github.com/openservicemesh/osm"
[[menu.main]]
name = "Blog"
weight = 40
url = "https://openservicemesh.io/blog"
[[menu.main]]
name = "Slack"
weight = 50
url = "https://cloud-native.slack.com/archives/C018794NV1C"
[[menu.main]]
name = "Twitter"
weight = 60
url = "https://twitter.com/openservicemesh"


# Add your release versions here
[[params.versions]]
version = "v0.4"
url = "https://docs.openservicemesh.io"


# Theme Additional params
[params]
copyright = "The Docsy Authors"
privacy_policy = "https://policies.google.com/privacy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13926,6 +13926,11 @@ body {
.td-navbar .navbar-brand span.text-uppercase {
position: absolute;
left: -999em; }
.td-navbar .nav-item.dropdown {
border-left: 1px solid #C1D6F1;
padding-left: 0.5rem; }
.td-navbar .nav-item.dropdown a {
font-weight: normal; }

.td-outer {
padding-top: 3.5rem; }
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Target":"css/style.72cb2c6f2d6d8c50c9d6936b2e00fee7e59524aee3f03816b38cc322b95c32c7.css","MediaType":"text/css","Data":{"Integrity":"sha256-csssby1tjFDJ1pNrLgD+5+WVJK7j8DgWs4zDIrlcMsc="}}
{"Target":"css/style.74e33816c5bef71d28bd77d9f7b20d298ef6ba145dd07dcbac68060d85cf8b7e.css","MediaType":"text/css","Data":{"Integrity":"sha256-dOM4FsW+9x0ovXfZ97INKY72uhRd0H3LrGgGDYXPi34="}}
9 changes: 9 additions & 0 deletions docs/themes/dosmy/assets/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ body {
left: -999em;
}
}

.nav-item.dropdown {
border-left: 1px solid $bluel;
padding-left: 0.5rem;

a {
font-weight: normal;
}
}
}

.td-outer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ .Site.Params.version_menu }}
Releases {{ .Site.Params.version_menu }}
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
{{ range .Site.Params.versions }}
Expand Down

0 comments on commit 981ce58

Please sign in to comment.