This site is based on Octopress, which is in turn based on Jekyll, with a dash of Twitter Bootstrap added.
The develop branch is continuously deployed to a preview site. View dev site
Please, feel free to make any contributions you feel will make SendGrid Documentation better.
- Clone the repo. Run
bundle install
. - Copy _config.sample.yml to _config.yml
- Set your root (if you're running locally it'll just be /) in _config.yml
- Run rake preview
- Browse to localhost:4000
-
The source files are in /source, and the generated files will be created in /public. They get overwritten or wiped out when the site is rebuilt.
-
To rebuild the site:
rake generate
The config is defined in _config.yml
.
The only config variables you should need to know about are root
, which is the root from which all links are calculated, and the folder_weights
hash, which specifies the order that the folders should be displayed in the nav tree. Higher weights mean higher display priority (higher in the tree). You can also specify icons for folders with the
folder_icons
hash.
There's also a version
number in the config.
The nav tree is generated by the plugin site_navigation.rb. It is essentially a recursive traversal of all the folders and pages in the Source folder that generates a hierarchical tree, sorted by folder weight and page weight.
Breadcrumbs are generated by the breadcrumbs.rb plugin.
You can write pages in markdown, HTML, or HAML. They all get converted to HTML when the site is generated.
Pages have a block of YAML at the top that sets a few options. They are pretty self explanatory; here's an example
---
layout: page
weight: 0
title: Docs Home
icon: icon-home
showTitle: false
navigation:
show: true
---
Weights are same as the folder weights - the higher numbers move higher up the tree. Icons are based on the CSS icon class names from Twitter Bootstrap. showTitle and navigation["show"] both default to true if not specified.
There are some custom plugins (look in the plugins
folger) that define new liquid blocks for use in pages.
You can create anchor tags that will have named anchors generated for them automatically with links on hover. The parameter is the wrapping element to use.
{% anchor h2 %}
Some Anchor Text
{% endanchor %}
Similarly you can create info and warning blocks:
{% info %}
Some info for a breakout block.
{% endinfo %}
{% warning %}
...And a warning breakout.
{% endwarning %}
If you are working on API reference docs, you can generate XML and JSON nav tabs with a liquid tag like so:
{% xmljsontabs foo %}
where foo
is a string unique to the page, e.g. a method name.
Make sure you have juicer and it's dependencies installed. This should be handled by bundler, but if you run into issues, read this note from the juicer gem docs:
You need Java installed and available on your PATH. During gem installation, Juicer will download and install YUI Compressor, Closure Compiler, JsLint and Rhino for you.
JavaScript and CSS are minified and combined using Juicer. The files to be packaged and their orders are specified in JsMinify.yml
and CssMinify.yml
. Image files referenced in CSS files are embedded as data-uri information, assuming they are not too large.
(The MIT License)
Copyright © 2008-2013 SendGrid Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.