diff --git a/docs/contributing/pages/components.mdx b/docs/contributing/pages/components.mdx index a6de8dbb63137..bed2e3289b9f1 100644 --- a/docs/contributing/pages/components.mdx +++ b/docs/contributing/pages/components.mdx @@ -195,16 +195,28 @@ See also the [Alert component](#alert). ## PageGrid -Render all child pages of this document, including their `description` if available. +Render all `next_steps` of this document or default child pages, including their `description` if available. + +You can specify `next_steps` in the frontmatter of a page to include them in the grid. It supports relative paths and will automatically resolve them. ```markdown {tabTitle:Example} +--- +# in the frontmatter of a page: +next_steps: + - ./child-one + - ./child-two + - ../parent/child-three +--- + ``` Attributes: - `header` (string) - optional header value to include, rendered as an H2 + - `nextPages` (boolean) - only render pages which come next based on sidebar ordering + - `exclude` (string[]) - an array of pages to exclude from the grid. Specify the file name of the page, for example, `"index"` for `index.mdx`. ## PlatformContent diff --git a/docs/platforms/php/guides/laravel/other-versions/laravel4.mdx b/docs/platforms/php/guides/laravel/other-versions/laravel4.mdx index b3ff03a0be7ed..e0ce3bb12f48e 100644 --- a/docs/platforms/php/guides/laravel/other-versions/laravel4.mdx +++ b/docs/platforms/php/guides/laravel/other-versions/laravel4.mdx @@ -63,5 +63,3 @@ If you wish to wire up Sentry anywhere outside of the standard error handlers, o ```php $app['sentry']->setRelease(Git::sha()); ``` - - diff --git a/docs/platforms/php/guides/laravel/other-versions/laravel5.mdx b/docs/platforms/php/guides/laravel/other-versions/laravel5.mdx index a3f97625d8cb6..0031df89c205e 100644 --- a/docs/platforms/php/guides/laravel/other-versions/laravel5.mdx +++ b/docs/platforms/php/guides/laravel/other-versions/laravel5.mdx @@ -99,5 +99,3 @@ You most likely don't want errors to be sent to Sentry when you are developing o You can also do this by not defining `SENTRY_LARAVEL_DSN` in your `.env` or by defining it as `SENTRY_LARAVEL_DSN=null`. If you do leave Sentry enabled when developing or running tests, it's possible for it to have a negative effect on the performance of your application or test suite. - - diff --git a/docs/platforms/php/guides/laravel/other-versions/laravel6-7.mdx b/docs/platforms/php/guides/laravel/other-versions/laravel6-7.mdx index 91ab4c8eaf4ba..03d41aa277574 100644 --- a/docs/platforms/php/guides/laravel/other-versions/laravel6-7.mdx +++ b/docs/platforms/php/guides/laravel/other-versions/laravel6-7.mdx @@ -93,5 +93,3 @@ You most likely don't want errors to be sent to Sentry when you are developing o You can also do this by not defining `SENTRY_LARAVEL_DSN` in your `.env` or by defining it as `SENTRY_LARAVEL_DSN=null`. If you do leave Sentry enabled when developing or running tests, it's possible for it to have a negative effect on the performance of your application or test suite. - - diff --git a/docs/platforms/php/guides/laravel/other-versions/lumen.mdx b/docs/platforms/php/guides/laravel/other-versions/lumen.mdx index a2951246a575d..61f5e7e07f219 100644 --- a/docs/platforms/php/guides/laravel/other-versions/lumen.mdx +++ b/docs/platforms/php/guides/laravel/other-versions/lumen.mdx @@ -87,5 +87,3 @@ You most likely don't want errors to be sent to Sentry when you are developing o You can also do this by not defining `SENTRY_LARAVEL_DSN` in your `.env` or by defining it as `SENTRY_LARAVEL_DSN=null`. If you do leave Sentry enabled when developing or running tests, it's possible for it to have a negative effect on the performance of your application or test suite. - - diff --git a/src/components/docPage/index.tsx b/src/components/docPage/index.tsx index 29878eeb7ea2e..aa7522d1b8539 100644 --- a/src/components/docPage/index.tsx +++ b/src/components/docPage/index.tsx @@ -4,7 +4,7 @@ import {getCurrentGuide, getCurrentPlatform, nodeForPath} from 'sentry-docs/docT import {serverContext} from 'sentry-docs/serverContext'; import {FrontMatter} from 'sentry-docs/types'; import {PaginationNavNode} from 'sentry-docs/types/paginationNavNode'; -import {isTruthy} from 'sentry-docs/utils'; +import {isNotNil} from 'sentry-docs/utils'; import {getUnversionedPath} from 'sentry-docs/versioning'; import './type.scss'; @@ -50,7 +50,7 @@ export function DocPage({ const pathname = serverContext().path.join('/'); - const searchPlatforms = [currentPlatform?.name, currentGuide?.name].filter(isTruthy); + const searchPlatforms = [currentPlatform?.name, currentGuide?.name].filter(isNotNil); const unversionedPath = getUnversionedPath(path, false); diff --git a/src/components/pageGrid.tsx b/src/components/pageGrid.tsx index 61c0da460c984..b7319138e1657 100644 --- a/src/components/pageGrid.tsx +++ b/src/components/pageGrid.tsx @@ -1,33 +1,36 @@ +import path from 'path'; + import Link from 'next/link'; -import {nodeForPath} from 'sentry-docs/docTree'; +import {DocNode, nodeForPath} from 'sentry-docs/docTree'; import {serverContext} from 'sentry-docs/serverContext'; -import {sortPages} from 'sentry-docs/utils'; +import {isNotNil, sortPages} from 'sentry-docs/utils'; type Props = { - nextPages: boolean; - /** - * A list of pages to exclude from the grid. - * Specify the file name of the page, for example, "index" for "index.mdx" - */ exclude?: string[]; header?: string; }; export function PageGrid({header, exclude}: Props) { - const {rootNode, path} = serverContext(); + const {rootNode, path: nodePath} = serverContext(); - const parentNode = nodeForPath(rootNode, path); - if (!parentNode) { + const parentNode = nodeForPath(rootNode, nodePath); + if (!parentNode || parentNode.children.length === 0) { return null; } + const children: DocNode[] = parentNode.frontmatter.next_steps?.length + ? (parentNode.frontmatter.next_steps + .map(p => nodeForPath(rootNode, path.join(parentNode.path, p))) + .filter(isNotNil) ?? []) + : parentNode.children; + return (