1
0
mirror of synced 2025-12-22 19:34:15 -05:00
Files
docs/content
Grace Park b98c83e924 REST operations sidebar (#26225)
* testing out a rest operations sidebar

* cleanup

* renamed 5 files

* renamed 5 files

* set redirect_from on 5 files

* renamed 1 files

* renamed 1 files

* renamed 3 files

* renamed 1 files

* renamed 1 files

* renamed 3 files

* renamed 1 files

* renamed 2 files

* renamed 1 files

* renamed 4 files

* renamed 15 files

* renamed 2 files

* renamed 6 files

* renamed 1 files

* renamed 4 files

* renamed 7 files

* renamed 1 files

* renamed 3 files

* renamed 3 files

* renamed 1 files

* renamed 5 files

* renamed 1 files

* renamed 1 files

* renamed 3 files

* renamed 4 files

* renamed 1 files

* renamed 1 files

* renamed 2 files

* renamed 4 files

* renamed 1 files

* renamed 1 files

* renamed 1 files

* renamed 6 files

* renamed 6 files

* renamed 4 files

* move files

* adding more

* updating to add restcontext and start of removing data/reusables/rest-reference

* removed data/reusables

* add a RestMiniTocItem and updating the filtering to add a subcategory so all manually added H3s are in mini tocs in addition to operations

* remove console log

* [WIP]: REST New Proposal Sidebar (#26471)

* saving

* update sidebar

* remove console log

* update guides and overview

* import Category for category level rest pages

* update undefined restOperations

* update restOperationData category and subcategory levels"

* minor updates

* update get mini toc items function

* updating REST context for sidebar

* updating rest data

* remove console logs

* WIP: mini-toc-ing the sidebar

Co-authored-by: Robert Sese <rsese@github.com>

* A little cleanup

* Fix first subcategory link and add some comments

* updating anchor links in sidebar

* adding updates

* remove standalone

* update product and maptopic pages using article context

* add conditional link wrapper

* fix sidebar toggle and versions for enterprise admin

* update versions per subcategory

* Highlight sidebar link for current page

* Update miniToc hash links and hash change tracking

* fix unique key in CollapsibleSection

* Fix list markup

* remove title

* update permissions

* Hide minitocs on landing (#26594)

* hide minitocs on landing page

* simplify page components and remove minitoc from sidebar for guides/overview

* fix carats and category fix

* remove id

Co-authored-by: Grace Park <gracepark@github.com>

* updating content based on versions script check with the OpenAPI

* update script and content files

* update script and content/rest files

* update to add TocLanding

* update script

* update index files

* add codespaces repository-secrets

* remove openapi schema check script

* remove minitocs at the top

* add h2 about the {title} api

* fix tests/unit/openapi-schema.js

* Fix linting tests

* fix search/topics test

* fix tests/unit/pages test

* update rest/reference links in components

* run prettier

* Update components/rest/RestReferencePage.tsx

Co-authored-by: Rachael Sewell <rachmari@github.com>

* Update components/rest/RestReferencePage.tsx

Co-authored-by: Rachael Sewell <rachmari@github.com>

* Update pages/[versionId]/rest/[category]/[subcategory].tsx

Co-authored-by: Rachael Sewell <rachmari@github.com>

* Update pages/[versionId]/rest/[category]/[subcategory].tsx

Co-authored-by: Rachael Sewell <rachmari@github.com>

* Update pages/[versionId]/rest/[category]/[subcategory].tsx

Co-authored-by: Rachael Sewell <rachmari@github.com>

* Update pages/[versionId]/rest/[category]/[subcategory].tsx

Co-authored-by: Rachael Sewell <rachmari@github.com>

* Update tests/unit/openapi-schema.js

Co-authored-by: Rachael Sewell <rachmari@github.com>

* updating comment location

* remove dependabot override

* remove path-utils current product update for rest

* run linter

* remove dependabot.md and remove h2 heading on restreference

* update the correct product to rest for rest pages

* adding comments for updates to path-utils

* remove console log

* REST sidebar: handle legacy v3 redirects (#26686)

* Add script to handle legacy v3 REST redirects

* Run the script

* Handle a redirect to a redirect

* Update REST test URLs

* 'await' and test runs subcategory of checks

* Update REST URLs for routing/developer-site-redirects tests

* Update developer-redirects fixture with new REST URLs

* Resolve merge conflicts

* Update rest-redirects fixture with new REST URLs

* Fix broken links with REST pages re-org

* redirectTo could be undefined

* Fix script for posterity, can't redirect paths with hashes

* Remove invalid hash redirects

* Typically don't need to save one-off scripts

* Undo redirect changes (not necessary for handling v3 redirects)

* Remove script-added redirects

* Update old v3 redirects with new REST URLs

* No more GHES search indexing page

* 'org' not 'organization'

* Update fixture data for new REST URLs

* revert any content directory changes

Co-authored-by: Grace Park <gracepark@github.com>
Co-authored-by: Rachael Sewell <rachmari@github.com>

* Adding test rest (#26750)

* add test to check openapi schema versions and content rest frontmatter versions

* update lib/redirects

* fix test and add error messages

* adding repository secrets

* adding repository-secrets.md

* Revert "update lib/redirects"

This reverts commit 3aafe28265764d5bc09c0c478c8e0ca099c8fbcf.

* remove lib/redirects changes and console logs

* Update lib/rest/index.js

Co-authored-by: Rachael Sewell <rachmari@github.com>

* update unique key

* Rest client side redirects (#26754)

* adding tags subcategory for the rest content repos category

* run prettier

* bug fix for anchor scrolls" (#26892)

* updating width size for rest reference page

* Rest sidebar consolidation (#26862)

* refactor sidebar

* fix articlecontext provider issue on rest product landing page for all versions

* fix a bug, create new component

* revert change to create new component and fix bug

Co-authored-by: Rachael Sewell <rachmari@github.com>

* Set currentAnchor with a hashchange handler (#26923)

* Rest sidebar design tweaks (#26807)

* Rest sidebar design tweaks

* tweak color to subtle

* use muted color and margin for line

* update to design feedback

Co-authored-by: Grace Park <gracepark@github.com>

* Remove cheerio from rest-collapsible (#26948)

* remove cheerio from rest-collapsible

* update type

* adding endswith instead

* use productId instead

* one off edge case for secret-scanning

* Reorganize subcategory and category, Update pre -> div, Add RestContext (#26950)

* reorganize subcategory and category

* add RestContext

* update comment

* update for endpoints page

* add comment

* move object to restcontext

* remove effectiveDate in restcontext

* remove width calculation for rest reference page

* fix adding manual writer's minitocs to sidebar

* update with feedback

* update comment

* update isRestReferencePage

* remove page component and fix bug

* adding back rest/index.tsx

Co-authored-by: Rachael Sewell <rachmari@github.com>

* update content/rest"

* add back design tweak

* update to div

* update margins on rest api reference

* remove page component

* adding tests

* separate product from rest sidebar (#27065)

* separate product from rest sidebar

* Use ProductCollapsibleSections for product pages

* fix tests

Co-authored-by: Robert Sese <rsese@github.com>
Co-authored-by: Grace Park <gracepark@github.com>

* Rest sidebar translations (#27052)

* update translations

* remove general test

Co-authored-by: Robert Sese <rsese@github.com>
Co-authored-by: Rachael Sewell <rachmari@github.com>
2022-04-20 10:19:48 -07:00
..
2022-04-20 07:22:14 +00:00
2022-04-19 20:14:18 +00:00
2022-04-06 14:40:16 +02:00
2022-03-03 13:08:24 -06:00
2022-04-20 10:19:48 -07:00
2022-03-15 13:35:02 +00:00

Content

The /content directory is where all the site's (English) Markdown content lives!

See the markup reference guide for more information about supported Markdown features.

See the contributing docs for general information about working with the docs.

Frontmatter

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. There's also a schema that's used by the test suite to validate every page's frontmatter. See lib/frontmatter.js.

versions

  • Purpose: Indicates the versions to which a page applies. See Versioning for more info.
  • Type: Object. Allowable keys map to product names and can be found in the versions object in lib/frontmatter.js.
  • This frontmatter value is currently required for all pages.
  • The * is used to denote all releases for the version.

Example that applies to GitHub.com and recent versions of GitHub Enterprise Server:

title: About your personal dashboard
versions:
  fpt: '*'
  ghes: '>=2.20'

Example that applies to all supported versions of GitHub Enterprise Server: (but not GitHub.com):

title: Downloading your license
versions:
  ghes: '*'

You can also version a page for a range of releases. This would version the page for GitHub.com, and GitHub Enterprise Server versions 2.22 and 3.0 only:

versions:
  fpt: '*'
  ghes: '>=2.22 <3.1'

redirect_from

  • Purpose: List URLs that should redirect to this page.
  • Type: Array
  • Optional

Example:

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/

See contributing/redirects for more info.

title

  • Purpose: Set a human-friendly title for use in the rendered page's <title> tag and an h1 element at the top of the page.
  • Type: String
  • Optional. If omitted, the page <title> will still be set, albeit with a generic value like GitHub.com or GitHub Enterprise.

shortTitle

  • Purpose: An abbreviated variant of the page title for use in breadcrumbs and navigation elements.
  • Type: String
  • Optional. If omitted, title will be used.
Article type Maximum character length
articles 31
categories 27
map topics 30

Example:

title: Contributing to projects with GitHub Desktop
shortTitle: Contributing to projects

intro

  • Purpose: Sets the intro for the page. This string will render after the title.
  • Type: String
  • Optional.

permissions

  • Purpose: Sets the permission statement for the article. This string will render after the intro.
  • Type: String
  • Optional.

product

  • Purpose: Sets the product callout for the article. This string will render after the intro and permissions statement.
  • Type: String
  • Optional.

layout

  • Purpose: Render the proper page layout.
  • Type: String that matches the name of the layout. For a layout named components/landing, the value would be product-landing.
  • Optional. If omitted, DefaultLayout is used.

children

  • Purpose: Lists the relative links that belong to the product/category/map topic. See Index pages for more info.
  • Type: Array. Default is false.
  • Required on index.md pages.

childGroups

  • Purpose: Renders children into groups on the homepage. See Homepage for more info.
  • Type: Array. Default is false.
  • Require on the homepage index.md.
  • Purpose: Renders the linked articles' titles and intros on product landing pages and the homepage.
  • Type: Object.
  • Optional.

The list of popular links are the links displayed on the landing page under the title "Popular." Alternately, you can customize the title "Popular" by setting the featuredLinks.popularHeading property to a new string.

Example:

featuredLinks:
  gettingStarted:
    - /path/to/page
  guides:
    - /guides/example
  popular:
    - /path/to/popular/article1
    - /path/to/popular/article2
  popularHeading: An alternate heading to Popular

showMiniToc

  • Purpose: Indicates whether an article should show a mini TOC above the rest of the content. See Autogenerated mini TOCs for more info.
  • Type: Boolean. Default is true on articles, and false on map topics and index.md pages.
  • Optional.

miniTocMaxHeadingLevel

  • Purpose: Indicates the maximum heading level to include in an article's mini TOC. See Autogenerated mini TOCs for more info.
  • Type: Number. Default is 2. Minimum is 2. Maximum is 3.
  • Optional.

allowTitleToDifferFromFilename

  • Purpose: Indicates whether a page is allowed to have a title that differs from its filename. For example, content/rest/reference/orgs.md has a title of Organizations instead of Orgs. Pages with this frontmatter set to true will not be flagged in tests or updated by script/reconcile-ids-with-filenames.js.
  • Type: Boolean. Default is false.
  • Optional.

changelog

  • Purpose: Render a list of items pulled from GitHub Changelog on product landing pages (ex: components/landing). The one exception is Education, which pulls from https://github.blog/category/community/education.
  • Type: Object, properties:
    • label -- must be present and corresponds to the labels used in the GitHub Changelog
    • prefix -- optional string that starts each changelog title that should be omitted in the docs feed. For example, with the prefix GitHub Actions: specified, changelog titles like GitHub Actions: Some Title Here will render as Some Title Here in the docs feed).
  • Optional.

defaultPlatform

  • Purpose: Override the initial platform selection for a page. If this frontmatter is omitted, then the platform-specific content matching the reader's operating system is shown by default. This behavior can be changed for individual pages, for which a manual selection is more reasonable. For example, most GitHub Actions runners use Linux and their operating system is independent of the reader's operating system.
  • Type: String, one of: mac, windows, linux.
  • Optional.

Example:

defaultPlatform: linux

defaultTool

  • Purpose: Override the initial tool selection for a page, where tool refers to the application the reader is using to work with GitHub (such as GitHub.com's web UI, the GitHub CLI, or GitHub Desktop) or the GitHub APIs (such as cURL or the GitHub CLI). For more information about the tool selector, see Markup reference for GitHub Docs. If this frontmatter is omitted, then the tool-specific content matching the GitHub web UI is shown by default. If a user has indicated a tool preference (by clicking on a tool tab), then the user's preference will be applied instead of the default value.
  • Type: String, one of: webui, cli, desktop, curl, codespaces, vscode, importer_cli, graphql, powershell, bash.
  • Optional.
defaultTool: cli

learningTracks

  • Purpose: Render a list of learning tracks on a product's sub-landing page.
  • type: String. This should reference learning tracks' names defined in data/learning-tracks/*.yml.
  • Optional

*Note: the featured track is set by a specific property in the learning tracks YAML. See that README for details.

includeGuides

  • Purpose: Render a list of articles, filterable by type and topics. Only applicable when used with layout: product-guides.
  • Type: Array
  • Optional.

Example:

includeGuides:
  - /actions/guides/about-continuous-integration
  - /actions/guides/setting-up-continuous-integration-using-workflow-templates
  - /actions/guides/building-and-testing-nodejs
  - /actions/guides/building-and-testing-powershell

type

  • Purpose: Indicate the type of article.
  • Type: String, one of the overview, quick_start, tutorial, how_to, reference.
  • Optional.

topics

  • Purpose: Indicate the topics covered by the article. The topics are used to filter guides on some landing pages. For example, the guides at the bottom of this page can be filtered by topics and the topics are listed under the guide intro. Topics are also added to all search records that get created for each page. The search records contain a topics property that is used to filter search results by topics. For more information, see the Search contributing guide. Refer to the content models for more details around adding topics. A full list of existing topics is located in the allowed topics file. If topics in article frontmatter and the allow-topics list become out of sync, the topics CI test will fail.
  • Type: Array of Strings
  • Optional: Topics are preferred for each article, but, there may be cases where existing articles don't yet have topics or a adding a topic to a new article may not add value.

contributor

  • Purpose: Indicate an article is contributed and maintained by a third-party organization, typically a GitHub Technology Partner.
  • Type: Object. Properties are name and URL.
  • Optional.

communityRedirect

  • Purpose: Set a custom link and link name for Ask the GitHub community link in the footer.
  • Type: Object. Properties are name and href.
  • Optional.

effectiveDate

  • For GitHub staff only: Set an effective date for Terms of Service articles so that engineering teams can automatically re-prompt users to confirm the terms
  • Type: string YEAR-MONTH-DAY e.g. 2021-10-04 is October 4th, 2021
  • Optional.

Example:

contributor:
  name: ACME, inc.
  URL: https://acme.example.com/

Escaping single quotes

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.

Autogenerated mini TOCs

Every article on the help site displays an autogenerated "In this article" section (aka mini TOC) at the top of the page that includes links to all H2s in the article by default.

  • To make the mini TOC include additional (or fewer) heading levels, you can add miniTocMaxHeadingLevel frontmatter to specify the maximum heading level. For example: miniTocMaxHeadingLevel: 3
  • To disable the mini TOC for a specific article, you can add this frontmatter: showMiniToc: false

Mini TOCs do not appear on product landing pages, category landing pages, or map topic pages.

Make sure not to add hardcoded "In this article" sections in the Markdown source or else the page will display duplicate mini TOCs.

Versioning

A content file can have two types of versioning:

  • versions frontmatter (required)
  • Liquid statements in content (optional)
    • Conditionally render content depending on the current version being viewed. See contributing/liquid-helpers for more info. Note Liquid conditionals can also appear in data and include files.

Note: As of early 2021, the free-pro-team@latest version is not included URLs. A helper function called lib/remove-fpt-from-path.js removes the version from URLs.

Filenames

When adding a new article, make sure the filename is a kebab-cased version of the title you use in the article's title frontmatter. This can get tricky when a title has punctuation (such as "GitHub's Billing Plans"). A test will flag any discrepancies between title and filename. To override this requirement for a given article, you can add allowTitleToDifferFromFilename frontmatter.

Whitespace control

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:

{%- ifversion fpt %}

Local links must start with a product ID (like /actions or /admin), and image paths must start with /assets. The links to Markdown pages undergo some transformations on the server side to match the current page's language and version. The handling for these transformations lives in lib/render-content/plugins/rewrite-local-links.

For example, if you include the following link in a content file:

/github/writing-on-github/creating-a-saved-reply

When viewed on GitHub.com docs, the link gets rendered with the language code:

/en/github/writing-on-github/creating-a-saved-reply

and when viewed on GitHub Enterprise Server docs, the version is included as well:

/en/enterprise-server@2.20/github/writing-on-github/creating-a-saved-reply

There are transformations for image paths in GitHub Enterprise Server (versions 2.20-3.0) only. Once those versions are deprecation, there will no longer be any transformations for image paths. For more information, see /assets/images/enterprise/legacy-format/README.md.

Preventing transformations

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="/github/site-policy/github-terms-of-service" class="dotcom-only">GitHub's Terms of Service</a>

Sometimes the canonical home of content moves outside the docs site. None of the links included in lib/redirects/external-sites.json get rewritten. See contributing/redirects.md for more info about this type of redirect.

Index pages

Index pages are the Table of Contents files for the docs site. Every product, category, and map topic subdirectory has an index.md that serves as the landing page. Each index.md must contain a children frontmatter property with a list of relative links to the child pages of the product, category, or map topic.

Important note: The site only knows about paths included in children frontmatter. If a directory or article exists but is not included in children, its path will 404.

Homepage

The homepage is the main Table of Contents file for the docs site. The homepage must have a complete list of children, like every Index page but must also specify the childGroups frontmatter property that will be highlighted in the main content area.

childGroups is an array of mappings containing a name for the group, an optional icon for the group, and an array of children. The children in the array must be present in the children frontmatter property.

Creating new product guides pages

To create a product guides page (e.g. Actions' Guide page), create or modify an existing markdown file with these specific frontmatter values:

  1. Use the product guides page template by referencing it layout: product-guides
  2. (optional) Include the learning tracks in learningTracks
  3. (optional) Define which articles to include with includeGuides.

If using learning tracks, they need to be defined in data/learning-tracks/*.yml. If using includeGuides, make sure each of the articles in this list has topics and type in its frontmatter.