You can make a limited range of edits from the Github site, but this system works best if you clone it locally so you can run test builds.
You will need to have Docker installed https://docs.docker.com/install/
- If using Linux, run
docker-compose up
- Visit http://localhost:4000/docsv2/
- If using OSX, install command line tools,
xcode-select --install
- Install
Ruby
https://www.ruby-lang.org/en/documentation/installation/ - Install
Node
https://nodejs.org/en/download/ - Install
Yarn
https://yarnpkg.com/en/docs/install - Install
Bundler
gem install bundler
- Run server,
make dev
- Visit http://localhost:4000/docsv2/
-
build
: Builds the site docs. Used by CI to publish the docs to staging and production -
nav
: Rebuilds the entire nav datafile based on the current doc structure. This is destructive and should not be used unless absolutely necessary. -
catalog
: Pulls in the latest catalog data from the Platform API and saves it in the respective data files. Requires an API key to be passed in env via PLATFORM_API_TOKEN -
seed
: copies all example data files out of the_templates
directory and puts them in the_data
directory. Useful if you don't have a way to setup an API key. -
clean
: removes all build artifacts -
clean-deps
: removes all doownloadedgems
andnode_modules
-
deps
: installs the requiredgems
andnode_modules
-
dev
: runsjekyll serve
locally with incremental builds. Useful when updating CSS, JS, or content and you don't want to rebuild everytime. -
docker-build: runs
make build
on a docker host. -
docker-dev: runs
make dev
on a docker host.
default.html
is the container through which all the individual other layouts (currently one, page.html
) are built to have the right title, seo, etc.
The Segment Config API is currently providing the data for the Source and Destination catalog pages. This happens at build time and the results are stored in the respective _data/catalog
yml files.
For local development, you can always run make seed
to use the example files if you don't want to mess with interacting with the Platform API.
The Platform API needs an API key to pull in the latest catalog data and currently looks for one in the environment variable PLATFORM_API_TOKEN
. This value is stored in a special file named .env
that the appropriate scripts reference. You can what this file looks like by looking at .env.example
If you want to interact with the Platform API, locally, first make sure you have run make env
. This will create the appropriate .env
file for you to work with
NOTE: Never check-in .env
or remove it from .gitignore
.
Once your local environment is configured, you then have two options to pull Platform API data: You can use the token in chamber
or you can create your own token. The one in chamber is also used by CircleCI when the docs are built + deployed.
If you installed and have access to chamber
, run the following command:
$ aws-okta exec prod-privileged -- chamber read segment-docs platform_api_key
or for staging...
$ aws-okta exec stage-privileged -- chamber read segment-docs platform_api_key
You should get something like this as the output of the command.
Key Value Version LastModified User
platform_api_key [REDACTED FOR DOCS] 2 08-05 10:24:55 arn:aws:sts::752180062774:assumed-role/production-write/bryan.mikaelian@segment.com
Edit the .env
file (generated from make env
) and replace the environment variable with the token above. make catalog
should then work and you should see some output like this:
$ make catalog
"Saving catalogs from Platform API..."
"Finished Destinations."
"Finished Sources."
"Done."
You create your own token via the Access Management Page. Feel free to use segment-engineering
or segment_prod
. Once you have the token, set the value in the .env
file.
By default, the links on the catalog page and respective sidenavs will attempt to automagically set hyperlinks, for actual doc file, at the path connections/:type/:slug
. However, given the transitory state of Docs V2, these links might 404 since the respective doc might be in a different directory.
These two catalogs are hardcoded in the _data
directory since the Config API does not expose these resources.
The sidenav is managed by the files in _data/sidenav/
. Depending on what section we are in determines the file used. We currently support up to 2 levels deep on a sidenav.
The current breadcrumb is currently determined based on the page.path
and the current page's title
front-matter attribute.
Swiftype is set up as a script in _layouts/default.html
We're using Rouge, set in the _config.yml
. It's now default for Jekyll 3 and later, so ๐.
A list of the cues Rouge accepts can be found here.
We're using Premonition for our Note blocks. This is stock right now, with four styles: note
, info
, warning
, and error
. We might build more later.
You'd write a block like this:
> warning "I am a warning"
> The body of the warning goes here. Premonition allows you to write any `Markdown` inside the block.
beta
: default false. When true, show an "in beta" warning in the page layout (see the warning in_includes/content/beta.md
)description
: takes a string. Adds the text here to the meta "description" tag used for SEO purposesfeedback
: defaults to true. When false, hide the feedback footer. Good for legal and landing pages,hidden
: omits the file from thesitemap.xml
and adds a<meta name="robots" content="noindex" />
to the top of the generated HTML file. TODO: it should probably also omit the item from the navbar generator script ๐คhide_toc
: hides the right-nav TOC that's generated from H2sintegration_type
: This is set on two paths in the_config.yml
to add a noun (Source or Destination) to the end of the title, and the end of the title tag in the html layout.landing
: defaults to false. Use this to drop the noun set byintegration_type
from the title and heading.redirect_from
: defaults to none. Takes an array of URLs from the frontmatter in a file, and generates a "stub" page at each URL. Each stub file redirects to the original file.seo-changefreq
: default:weekly
. Use the values in the sitemap spec. - sets thechangefreq
tag in the sitemap.xml generator, which tells search crawlers how often to check back.seo-priority
: values from1.0
to0.1
, default:0.5
. Sets thePriority
tag in the sitemap