The /content
directory is where all the site's (English) Markdown content lives!
See the Markup Reference Guide in the product-documentation
repo for more info about supported Markdown features.
See the top-level README for general info about how the site works.
- Frontmatter
- Index Pages
- Hidden Pages
- Category Pages
- Map Topic Pages
- Versioning
- Filenames
- Whitespace Control
- Links and image paths
YAML Frontmatter is an authoring convention popularized by Jekyll that provides a way to add metadata to pages. It is a block of key-value content that lives at the top of every Markdown file. The following frontmatter values have special meanings and requirements for this site:
hidden
- Purpose: Indicates whether a page should be excluded from searches, crawlers, TOCs, etc. See Hidden Pages for more info.
- Type:
Boolean
. Default isfalse
.
- Purpose: Indicates the products and product versions to which a page applies. See Versioning for more info.
- Type:
Object
. Allowable keys aredotcom
andenterprise
- This frontmatter value is currently required for all pages.
Example that applies to GitHub.com and recent versions of GitHub Enterprise:
title: About your personal dashboard
productVersions:
dotcom: '*'
enterprise: '>=2.14'
Example that applies to all supported versions of GitHub enterprise (but not GitHub.com):
title: Downloading your license
productVersions:
enterprise: '*'
Note: dotcom
is an evergreen product without versions, so the *
is used to denote all versions.
- Purpose: List URLs that should redirect to this page.
- Type:
Array
(for multiple redirects) orString
(for just one) - Optional
Example with multiple redirects:
title: Getting Started with GitHub Desktop
redirect_from:
- /articles/first-launch/
- /articles/error-github-enterprise-version-is-too-old/
- /articles/getting-started-with-github-for-windows/
Example with a single redirect:
title: Denying access to a previously approved OAuth App for your organization
redirect_from: /articles/denying-access-to-a-previously-approved-application-for-your-organization/
See README#redirects for more info.
- Purpose: Set a human-friendly title for use in the rendered page's
<title>
tag and anh1
element at the top of the page. - Type:
String
- Optional. If omitted, the page
<title>
will still be set, albeit with a generic value likeGitHub.com
orGitHub Entperprise
.
- Purpose: Sets the intro for the article.
- Type:
String
- Optional.
- Purpose: Wrap the page in a custom HTML layout.
- Type:
String
that matches the name of the layout file, without an extension. For a layout namedlayouts/article.html
, the value would bearticle
. - Optional. If omitted,
layouts/default.html
is used.
- Purpose: Indicates whether a page is a map topic. See Map Topic Pages for more info.
- Type:
Boolean
. Default isfalse
. - Optional.
If you see two single quotes in a row (''
) in YML frontmatter where you might expect to see one ('
), this is the YML-preferred way to escape a single quote. From the YAML spec:
In single quoted leaves, a single quote character needs to be escaped. This is done by repeating the character.
As an alternative, you can change the single quotes surrounding the frontmatter field to double quotes and leave interior single quotes unescaped.
Index pages are written in Markdown, and are always named index.md
. They exist as landing pages dedicated to specific GitHub products or topical groupings of articles. Each index page contains a Table of Contents (TOC) with links to articles.
Product indexes:
Filename | URL Path | Purpose |
---|---|---|
/index.md |
/ | GitHub.com and GitHub Enterprise "User" Docs |
/enterprise/index.md |
/enterprise | GitHub Enterprise |
/enterprise/admin/index.md |
/enterprise/admin | Enterprise Admin |
/desktop/index.md |
/desktop | Desktop |
GitHub Enterprise Admin also has index pages:
Filename | URL Path | Purpose |
---|---|---|
/enterprise/admin/clustering/index.md |
/enterprise/admin/clustering | Clustering |
/enterprise/admin/developer-workflow/index.md |
/enterprise/admin/developer-workflow | Developer Workflow |
/enterprise/admin/enterprise-support/index.md |
/enterprise/admin/enterprise-support | Enterprise Support |
/enterprise/admin/installation/index.md |
/enterprise/admin/installation | Installation |
/enterprise/admin/migrations/index.md |
/enterprise/admin/migrations | Migrations |
/enterprise/admin/user-management/index.md |
/enterprise/admin/user-management | User Management |
See <enterprise/admin/README.md> for details on how guides should be written.
Desktop guides also have index pages:
Filename | URL Path | Purpose |
---|---|---|
/desktop/contributing-to-projects |
/desktop/contributing-to-projects | Contributing to Projects |
/desktop/getting-started-with-github-desktop |
/desktop/getting-started-with-github-desktop | Getting Started with GitHub Desktop |
Note: All links to GitHub Desktop Classic (such as https://help.github.com/desktop-classic
) now redirect to https://desktop.github.com.
The file content/index.md
is rendered as a long TOC on the https://help.github.com homepage.
The formatting of this file must adhere to a specific structure in order for the site to render the page properly and create automatic links to articles:
Content type | Formatting | Example |
---|---|---|
Category | h2 |
## Bootcamp |
Map topic | h3 |
### Managing user account settings |
Article | List item | - Set up git |
See Whitespace Control for info on using Liquid conditionals within TOC lists.
Hidden Pages
Hidden pages are publicly accessible but excluded from the search index, and they're not linked to by any other pages.
In development, you can view a list of all hidden pages by visiting localhost:4000/hidden. Note, however, that this page is not available in production.
To make a page hidden, add hidden: true
to its YAML frontmatter.
Category pages are only found in Dotcom docs (e.g., https://help.github.com/categories/bootcamp). The content displayed on these pages is autogenerated from the category's parent index page, where the name of the category is an h2
.
Every category in the index page must have a corresponding placeholder file in content/dotcom/categories
ending in .md
. You can add redirects to the placeholder files.
Map topics are found in Dotcom, Enterprise Admin, and Desktop docs. The content displayed on these pages is autogenerated from each map topic's parent index page. Map topic files live alongside article files.
To make a page a map topic, add mapTopic: true
to its YAML frontmatter and leave the rest of the file empty.
Versioning for any content file lives in two places:
- The file's
productVersions
frontmatter. - Liquid conditionals in the file's parent index page.
For example, an article with this frontmatter:
title: About your personal dashboard
productVersions:
dotcom: '*'
enterprise: '>=2.14'
should be referenced in the parent index page like this: {%- if page.version == 'dotcom' or page.version ver_gt "2.13" %}
- About your personal dashboard {%- endif %}
The site automatically creates links to articles in index pages. For example, this block in content/index.md
:
## Bootcamp
- Set up git
- Create a repo
- Fork a repo
- Be social
renders with links to each article.
If you're adding a new article, make sure the filename is a kebab-cased version of the title you use in both the article and the parent index. This can get tricky when a title has punctuation (such as "GitHub's Billing Plans"). If you're not sure what the filename should be based on the title, you can find out by adding the title to the TOC. For example:
## Bootcamp
- Set up git
- Create a repo
- Fork a repo
- Be social
- I'm a new article
Then just run the site locally and see what the link is. In this example, the filename would be: im-a-new-article
When using Liquid conditionals in lists or tables, you can use whitespace control characters to prevent the addition of newlines that would break the list or table rendering.
Just add a hyphen on either the left, right, or both sides to indicate that there should be no newline on that side. For example, this statement removes a newline on the left side: {%- if page.version == 'dotcom' %} These characters are especially important in index pages comprised of list items.
Any local links (like those starting with /articles/
) and image paths (starting with /assets
) that you include in content and data files will undergo some transformations on the server side to match the current page's language and Enterprise version (if applicable). The handling for these transformations lives in lib/rewrite-local-links
and lib/rewrite-asset-paths-to-s3
.
For example, if you include the following link in a content file:
/articles/creating-a-saved-reply
When viewed on Dotcom, the link gets rendered with the language code:
/en/articles/creating-a-saved-reply
and when viewed on GHE, the version is included as well:
/en/enterprise/2.16/user/articles/creating-a-saved-reply
The transformation is a little simpler for image paths. If you include the following image path in a content file:
/assets/images/help/profile/follow-user-button.png
when viewed on GHE, the path gets rewritten to include S3:
https://github-images.s3.amazonaws.com/enterprise/2.16/assets/images/help/profile/follow-user-button.png
Sometimes you want to link to a Dotcom-only article in Enterprise content and you don't want the link to be Enterprise-ified. To prevent the transformation, write the link using HTML and add a class of dotcom-only
. For example:
<a href="/articles/github-terms-of-service/" class="dotcom-only">GitHub's Terms of Service</a>
Sometimes the canonical home of content moves outside the help site. None of the links included in lib/external-redirects.json
get rewritten. See the top-level README for more info about this type of redirect.