A bit of doc restructuring

This commit is contained in:
Joel Marcey 2016-10-12 20:21:18 -07:00
parent 9e7fda8299
commit 89cc404dea
11 changed files with 118 additions and 33 deletions

View File

@ -1,5 +1,33 @@
This provides guidance on how to contribute various content to `rocksdb.org`. This provides guidance on how to contribute various content to `rocksdb.org`.
## Getting started
You should only have to do these one time.
- Rename this file to `CONTRIBUTING.md`.
- Rename `EXAMPLE-README-FOR-RUNNING-DOCS.md` to `README.md` (replacing the existing `README.md` that came with the template).
- Rename `EXAMPLE-LICENSE` to `LICENSE`.
- Checkout the [template information](./TEMPLATE-INFORMATION.md).
- Review `./_config.yml`.
- Make sure you update `title`, `description`, `tagline` and `gacode` (Google Analytics) in `./_config.yml`.
## Basic Structure
Most content is written in markdown. You name the file `something.md`, then have a header that looks like this:
```
---
docid: getting-started
title: Getting started with ProjectName
layout: docs
permalink: /docs/getting-started.html
---
```
Customize these values for each document, blog post, etc.
> The filename of the `.md` file doesn't actually matter; what is important is the `docid` being unique and the `permalink` correct and unique too).
## Landing page ## Landing page
Modify `index.md` with your new or updated content. Modify `index.md` with your new or updated content.
@ -37,11 +65,13 @@ or with a combination of changing `./_data/features.yml` and adding some Liquid
## Blog ## Blog
To modify a blog post, edit the appopriate markdown file in `./_posts/`.
Adding a new blog post is a four-step process. Adding a new blog post is a four-step process.
> Some posts have a `permalink` and `comments` in the blog post YAML header. You will not need these for new blog posts. These are an artifact of migrating the blog from Wordpress to gh-pages. > Some posts have a `permalink` and `comments` in the blog post YAML header. You will not need these for new blog posts. These are an artifact of migrating the blog from Wordpress to gh-pages.
1. Create your blog post in `./_posts` in markdown (file extension `.md` or `.markdown`). See current posts in that folder or `2016-04-07-blog-post-example.md` for an example of the YAML format. **If the `./_posts` directory does not exist, create it**. 1. Create your blog post in `./_posts/` in markdown (file extension `.md` or `.markdown`). See current posts in that folder or `./doc-type-examples/2016-04-07-blog-post-example.md` for an example of the YAML format. **If the `./_posts` directory does not exist, create it**.
- You can add a `<!--truncate-->` tag in the middle of your post such that you show only the excerpt above that tag in the main `/blog` index on your page. - You can add a `<!--truncate-->` tag in the middle of your post such that you show only the excerpt above that tag in the main `/blog` index on your page.
1. If you have not authored a blog post before, modify the `./_data/authors.yml` file with the `author` id you used in your blog post, along with your full name and Facebook ID to get your profile picture. 1. If you have not authored a blog post before, modify the `./_data/authors.yml` file with the `author` id you used in your blog post, along with your full name and Facebook ID to get your profile picture.
1. [Run the site locally](./README.md) to test your changes. It will be at `http://127.0.0.1/blog/your-new-blog-post-title.html` 1. [Run the site locally](./README.md) to test your changes. It will be at `http://127.0.0.1/blog/your-new-blog-post-title.html`
@ -49,13 +79,13 @@ Adding a new blog post is a four-step process.
## Docs ## Docs
To modify docs, edit the appropriate markdown file in `./_docs`. To modify docs, edit the appropriate markdown file in `./_docs/`.
To add docs to the site, .... To add docs to the site....
1. Add your markdown file to the `./_docs` folder. See `./docs-hello-world.md` for an example of the YAML header format. 1. Add your markdown file to the `./_docs/` folder. See `./doc-type-examples/docs-hello-world.md` for an example of the YAML header format. **If the `./_docs/` directory does not exist, create it**.
- You can use folders in the `./_docs` directory to organize your content if you want. **If the `./_docs` directory does not exist, create it**. - You can use folders in the `./_docs/` directory to organize your content if you want.
1. Update `_data/nav_docs.yml` to add your new document to the navigation bar. Use the `id` you put in your doc markdown in ad the id in the `_data/nav_docs.yml` file. 1. Update `_data/nav_docs.yml` to add your new document to the navigation bar. Use the `docid` you put in your doc markdown in as the `id` in the `_data/nav_docs.yml` file.
1. [Run the site locally](./README.md) to test your changes. It will be at `http://127.0.0.1/docs/your-new-doc-permalink.html` 1. [Run the site locally](./README.md) to test your changes. It will be at `http://127.0.0.1/docs/your-new-doc-permalink.html`
1. Push your changes to GitHub. 1. Push your changes to GitHub.
@ -65,7 +95,17 @@ To modify the header bar, change `./_data/nav.yml`.
## Top Level Page ## Top Level Page
If you want a top-level page (e.g., http://rocksdb.org/support.html) -- not in `/blog` or `/docs` -- then you can create a markdown file in the root `./`. See `./top-level-example.md` for more information. To modify a top-level page, edit the appropriate markdown file in `./top-level/`
If you want a top-level page (e.g., http://your-site.com/top-level.html) -- not in `/blog/` or `/docs/`....
1. Create a markdown file in the root `./top-level/`. See `./doc-type-examples/top-level-example.md` for more information.
1. If you want a visible link to that file, update `_data/nav.yml` to add a link to your new top-level document in the header bar.
> This is not necessary if you just want to have a page that is linked to from another page, but not exposed as direct link to the user.
1. [Run the site locally](./README.md) to test your changes. It will be at `http://127.0.0.1/your-top-level-page-permalink.html`
1. Push your changes to GitHub.
## Other Changes ## Other Changes

View File

@ -4,25 +4,29 @@ This directory will contain the user and feature documentation for RocksDB. The
### Contributing ### Contributing
See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution details. See [CONTRIBUTING.md](./CONTRIBUTING.md) for details on how to add or modify content.
### Run the Site Locally ### Run the Site Locally
The requirements for running a GitHub pages site locally is described in [GitHub help](https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/#requirements). The steps below summarize these steps. The requirements for running a GitHub pages site locally is described in [GitHub help](https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/#requirements). The steps below summarize these steps.
> If you have run the site before, you can start with step 1 and then move on to step 5.
1. Ensure that you are in the `YOUR-PROJECT/docs` directory in your local repo clone (i.e., the same directory where this `README.md` exists). The below RubyGems commands, etc. must be run from there.
1. Make sure you have Ruby and [RubyGems](https://rubygems.org/) installed. 1. Make sure you have Ruby and [RubyGems](https://rubygems.org/) installed.
> Ruby >= 2.2 is required for the gems. On the latest versions of Mac OS X, Ruby 2.0 is the > Ruby >= 2.2 is required for the gems. On the latest versions of Mac OS X, Ruby 2.0 is the
> default. Use `brew install ruby` (or your preferred upgrade mechanism) to install a newer > default. Use `brew install ruby` (or your preferred upgrade mechanism) to install a newer
> version of Ruby for your Mac OS X system. > version of Ruby for your Mac OS X system.
2. Make sure you have [Bundler](http://bundler.io/) installed. 1. Make sure you have [Bundler](http://bundler.io/) installed.
``` ```
# may require sudo # may require sudo
gem install bundler gem install bundler
``` ```
3. Install the project's dependencies 1. Install the project's dependencies
``` ```
# run this in the 'docs' directory # run this in the 'docs' directory
@ -35,15 +39,25 @@ The requirements for running a GitHub pages site locally is described in [GitHub
> `xcode-select --install` (although this may not work if you have already installed command > `xcode-select --install` (although this may not work if you have already installed command
> line tools). > line tools).
4. Run Jekyll's server. 1. Run Jekyll's server.
- On first runs or for structural changes to the documentation (e.g., new sidebar menu item), do a full build.
``` ```
bundle exec jekyll serve --config=_config.yml,_config_local_dev.yml bundle exec jekyll serve --config=_config.yml,_config_local_dev.yml
``` ```
- For content changes only, you can use `--incremental` for faster builds.
```
bundle exec jekyll serve --config=_config.yml,_config_local_dev.yml --incremental
```
> We use `bundle exec` instead of running straight `jekyll` because `bundle exec` will always use the version of Jekyll from our `Gemfile`. Just running `jekyll` will use the system version and may not necessarily be compatible. > We use `bundle exec` instead of running straight `jekyll` because `bundle exec` will always use the version of Jekyll from our `Gemfile`. Just running `jekyll` will use the system version and may not necessarily be compatible.
5. The site will be served from http://localhost:4000. > The `_config_local_dev` file overrides some URL settings that you might be using in production to allow you to test links, etc. locally.
1. Either of commands in the previous step will serve up the site on your local device at http://127.0.0.1:4000/ or http://localhost:4000.
### Updating the Bundle ### Updating the Bundle

View File

@ -0,0 +1,17 @@
## Template Details
First, go through `_config.yml` and adjust the available settings to your project's standard. When you make changes here, you'll have to kill the `jekyll serve` instance and restart it to see those changes, but that's only the case with the config file.
Next, update some image assets - you'll want to update `favicon.png`, `logo.svg`, and `og_image.png` (used for Like button stories and Shares on Facbeook) in the `static` folder with your own logos.
Next, if you're going to have docs on your site, keep the `_docs` and `docs` folders, if not, you can safely remove them (or you can safely leave them and not include them in your navigation - Jekyll renders all of this before a client views the site anyway, so there's no performance hit from just leaving it there for a future expansion).
Same thing with a blog section, either keep or delete the `_posts` and `blog` folders.
You can customize your homepage in three parts - the first in the homepage header, which is mostly automatically derived from the elements you insert into your config file. However, you can also specify a series of 'promotional' elements in `_data/promo.yml`. You can read that file for more information.
The second place for your homepage is in `index.md` which contains the bulk of the main content below the header. This is all markdown if you want, but you can use HTML and Jekyll's template tags (called Liquid) in there too. Checkout this folder's index.md for an example of one common template tag that we use on our sites called gridblocks.
The third and last place is in the `_data/powered_by.yml` and `_data/powered_by_highlight.yml` files. Both these files combine to create a section on the homepage that is intended to show a list of companies or apps that are using your project. The `powered_by_highlight` file is a list of curated companies/apps that you want to show as a highlight at the top of this section, including their logos in whatever format you want. The `powered_by` file is a more open list that is just text links to the companies/apps and can be updated via Pull Request by the community. If you don't want these sections on your homepage, just empty out both files and leave them blank.
The last thing you'll want to do is setup your top level navigation bar. You can do this by editing `nav.yml` and keeping the existing title/href/category structure used there. Although the nav is responsive and fairly flexible design-wise, no more than 5 or 6 nav items is recommended.

View File

@ -30,13 +30,18 @@ color:
# apikey: "" # apikey: ""
# indexname: "" # indexname: ""
# Blog posts are builtin to Jekyll by default, with the `_posts` directory.
# Here you can specify other types of documentation. The names here are `docs`
# and `top-level`. This means their content will be in `_docs` and `_top-level`.
# The permalink format is also given.
# http://ben.balter.com/2015/02/20/jekyll-collections/
collections: collections:
docs: docs:
output: true output: true
permalink: /docs/:name/ permalink: /docs/:name/
support: top-level:
output: true output: true
permalink: /support.html permalink: :name.html
# DO NOT ADJUST BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE CHANGING # DO NOT ADJUST BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE CHANGING

View File

@ -1,5 +1,5 @@
--- ---
layout: support layout: top-level
title: Support title: Support
id: support id: support
category: support category: support

View File

@ -5,6 +5,8 @@ author: exampleauthor
category: blog category: blog
--- ---
Any local blog posts would go in the `_posts` directory.
This is an example blog post introduction, try to keep it short and about a paragraph long, to encourage people to click through to read the entire post. This is an example blog post introduction, try to keep it short and about a paragraph long, to encourage people to click through to read the entire post.
<!--truncate--> <!--truncate-->
@ -12,3 +14,8 @@ This is an example blog post introduction, try to keep it short and about a para
Everything below the `<!--truncate-->` tag will only show on the actual blog post page, not on the `/blog/` index. Everything below the `<!--truncate-->` tag will only show on the actual blog post page, not on the `/blog/` index.
Author is defined in `_data/authors.yml` Author is defined in `_data/authors.yml`
## No posts?
If you have no blog for your site, you can remove the entire `_posts` folder. Otherwise add markdown files in here. See CONTRIBUTING.md for details.

View File

@ -0,0 +1,12 @@
---
docid: hello-world
title: Hello, World!
layout: docs
permalink: /docs/hello-world.html
---
Any local docs would go in the `_docs` directory.
## No documentation?
If you have no documentation for your site, you can remove the entire `_docs` folder. Otherwise add markdown files in here. See CONTRIBUTING.md for details.

View File

@ -0,0 +1,8 @@
---
layout: top-level
title: Support Example
id: top-level-example
category: top-level
---
This is a static page disconnected from the blog or docs collections that can be added at a top-level (i.e., the same level as `index.md`).

View File

@ -1,10 +0,0 @@
# Any local docs would go in this directory
#---
#docid: hello-world
#title: Hello, World!
#layout: docs
#permalink: /docs/hello-world.html
#---
#This is some placeholder text, but you can use any kind of Markdown syntax here.

View File

@ -1,8 +0,0 @@
#---
#layout: support
#title: Support Example
#id: support
#category: support
#---
#
#This is a static page disconnected from the blog or docs collections that can be added at a top-level.