Okta developer site (developer.okta.com) is a custom Jekyll site deployed on GitHub pages
All API documentation submissions are welcome. To submit a change, fork this repo, commit your changes, and send us a pull request
Most of the content of the developer site is written in a format called kramdown which is a flavor of Markdown with some enhanced features like the ability to do footnote notations. We use Kramdown because the markup is both human readable and convertable in to fully fledged HTML. If there's some functionality you can't implement in Kramdown you can always drop down into HTML as a last resort.
Though kramdown gives us benefits of readbilty it comes at the cost of requiring a build step to preview the changes to the site. Jekyll, handles this nicely by detecting changes to the file system and refreshing automatically. To setup Jekyll to be able to build and view the site, follow the steps below:
- Install RVM if you don't already have it. On OSX
brew install rvmor on linuxyum install rvm. To ensure you have rvm installed properly runrvm listand ensure that there is a version marked as 'current'. - Clone repository
git clone [email protected]:okta/okta.github.io.git - Go into project directory
cd okta.github.io - You maybe told that the version of ruby needed by this project isn't installed, follow the given instruction to
install the correct verion of ruby for RVM. If you did have to install a new version of ruby re-enter the directory
you're in.
cd ..;cd okta.github.iothen verify that the current gemset you're using is called "okta.github.io" by runningrvm gemset list. This project sepcifies a gemset so that the build of this project isn't affected by global gems on your system. - Now install gems needed by this project into the projects gemset with
gem install bundlerand thenbundle install. This will essentially read the Gemfile in the root directory and install all packages required to run the site. - Start the site
bundle exec jekyll serve --watch - Visit
http://localhost:4000in your browser - To stop serving the site hit
ctrl+cin the terminal
Though github pages do support an automatic build process, we use a custom toolbar gem which requires that we build the site ourselves. This means that this git repo contains both the source files of the site and the compiled site files. As we edit the site we should only make changes to the source files and then rely on the following build process to compile and generate the final site content.
- _source this is where the source files live. If you're editing content, or adding assets like images or css, they belong in here
- _site this directory is ignored in github. It contains the local version of each of the built files in the site
- almost everything else most of the other directories in the root are the checked in versions of the built site. These files should not be edited directly. Find the corresponding version of the file in the _source directory, modify that and then re-run the build.
- Create a topic branch or your work
git checkout -b <branch_name> - Make changes / additions in _source directory
- Compile changes into the _site directory
bundle exec jekyll serve --watch - Navigate the site and validate your changes
- Stop Jekyll with
ctrl+c - Sync the built _site files with the checked-in code with:
rsync -av _site/ ./ - Git commit and push changes to github. When ready for review create a pull request and mention the users you want to review your changes.
If you are making changes in a fork, here is how to make a clean Pull Request against "upstream":
- sync your fork to https://github.com/okta/okta.github.io/
The command
git remote add upstream [email protected]:okta/okta.github.io.gitis the key part of this step. - After running
git fetch upstreamin the guide above, run this command to pull down changes from upstream:git merge -s recursive -X theirs upstream/master
Okta uses the GitHub Flow workflow for contributions.
Please read the linked GitHub Flow document to learn the details of that workflow.
Here is a high-level overview of the GitHub flow:
- (Optional) Fork this repository.
- Create a branch using the
git checkout -b $BRANCH_NAMEcommand. Replace$BRANCH_NAMEwith your branch name. - Add commits to your branch using the
git addandgit commit -m ""commands. Push your commits to your branch with thegit pushcommand (for example:git push origin $BRANCH_NAME). - Open a Pull Request using the GitHub UI.
- Discuss and review your code using the GitHub UI.
- Once your Pull Request has been reviewed and approved, one of the project owners for this site will merge and deploy your Pull Request.
- Clone repository using
git clone- the files are organized in this repository as follows:- The root folder
./contains the files served by GitHub. _sourcefolder contains the source files._siteis still ignored.
- The root folder
- Create a branch for your changes using
git checkout -b $BRANCH_NAMEto create a branch for your changes. - Make changes under the
_sourcedirectory. - Serve the site locally using the
jekyll serve -wcommand. - Preview using http://locahost:4000.
Do the following after accepting a pull request:
- Pull down the latest changes using
git pull origin masterto pull down the latest changes. - Compile the site locally using the
jekyll buildcommand. - rsync files from the
_sitedirectory to repository root directory./with thersync -r _site/ ./command. - Add the updated files using the
git add .command. - Commit the updated files using the
git commit -m "your message here"command. - Push to GitHub using
git push origin masterto push to GitHub. Note that GitHub will not compile the site.
Pages are single purpose html or markdown files
- Create a folder with
index.htmlfile. (e.g. pricing/index.html) - Author front matter as follows:
---
layout: page
title: YOUR_TITLE
css: CSS_FILENAME.css (optional page specific css file)
---
- Put html or css content under front matter
- Expose link to page in header or elsewhere. URL will be the folder
name,
index.htmlis not necessary (e.g. /pricing)
- Create
PAGE_NAME.mdindocs/FOLDER_NAME(e.g. docs/api/rest/users.md) - Filenames are underscore seperated and all lowercase. (e.g. my_cool_doc_page.md)
- Author front matter
---
layout: docs_page
title: Title Case Name of Page
---
- The content under the front matter should not have any
h1s - this will be set by thetitleproperty - All
h2s in the content will be rendered as a link in the table of contents - Create placement entry in manifest at
_data/docs.ymlin appropriatepagessection. - The
pagesname must match the filename without extension. (e.g.users.md=>users) - To create a new section in the manifest
section: NAME_OF_FOLDER
title: TITLE_CASE_NAME_OF_SECTION
- The sections structure should follow the folder names
- The ordering of sections and pages in the manifest determines the order in which they appear in the leftnav
- Create an
index.mdfolder incustomers/CUSTOMER_NAME(e.g. customers/box/index.md) - Create the images:
`index_image`: 220px x 165px @144dpi // image used on index page
`header_image`: 1080px x 220px @144dpi // title bar image on story page
`diagram_image`: 694px x <n>px @144dpi // information graphic at bottom of story page
- Author front matter
`index_blurb` will be clipped over three lines of text
`sidebar_copy` will be markdownified. Newlines sohuld be doubled.
- Create an entry in _source/_data/authors.yml
- Put avatar image in _source/assets/img. Make sure aspect ratio of image is square.
- Create a file in
_source/_posts/with the formYYYY-mm-dd-the-title.md - The header should look something like:
---
layout: blog_post
title: Productionalizing ActiveMQ
author: okta_generic_blogger
tags: [activemq, jvm]
---
- Supporting images should be placed in
_source/assets/imgand should follow the convetion:<name_of_post>-image-name.extensionwhere name of the post doesn't include the ".md" extension. This will allow us to know which images are referenced by which post. - Look at other posts for examples.