From 9344d3ed9a46ae40c156ad58ece77e0bdddd976d Mon Sep 17 00:00:00 2001 From: Sarah Edwards Date: Mon, 14 Jun 2021 16:59:28 -0700 Subject: [PATCH 1/2] Landing pages only shows "view all" and "expore all" buttons if a guides page exists (#19914) Co-authored-by: Sarah Schneider Co-authored-by: Mike Surowiec --- components/context/ProductLandingContext.tsx | 7 +++++-- components/landing/GuideCards.tsx | 4 ++-- layouts/product-landing.html | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/components/context/ProductLandingContext.tsx b/components/context/ProductLandingContext.tsx index b091f0a171..9e8fdcc43e 100644 --- a/components/context/ProductLandingContext.tsx +++ b/components/context/ProductLandingContext.tsx @@ -51,6 +51,7 @@ export type ProductLandingContextT = { changelogUrl?: string whatsNewChangelog?: Array<{ href: string; title: string; date: string }> tocItems: Array + hasGuidesPage: boolean releases: Array<{ version: string firstPreviousRelease: string @@ -76,6 +77,7 @@ export const useProductLandingContext = (): ProductLandingContextT => { export const getProductLandingContextFromRequest = (req: any): ProductLandingContextT => { const productTree = req.context.currentProductTree const page = req.context.page + const hasGuidesPage = page.children.includes('/guides') return { ...pick(page, [ 'title', @@ -85,6 +87,7 @@ export const getProductLandingContextFromRequest = (req: any): ProductLandingCon 'intro', 'product_video', ]), + hasGuidesPage, product: { href: productTree.href, title: productTree.renderedShortTitle || productTree.renderedFullTitle, @@ -131,8 +134,8 @@ export const getProductLandingContextFromRequest = (req: any): ProductLandingCon return { label: req.context.site.data.ui.toc[key], viewAllHref: - key === 'guides' && !req.context.currentCategory - ? `${req.context.currentPath}/${key}` + key === 'guides' && !req.context.currentCategory && hasGuidesPage + ? `${req.context.currentPath}/guides` : '', articles: links.map((link: any) => { return { diff --git a/components/landing/GuideCards.tsx b/components/landing/GuideCards.tsx index d24015d1db..18dfc73480 100644 --- a/components/landing/GuideCards.tsx +++ b/components/landing/GuideCards.tsx @@ -10,7 +10,7 @@ import { GuideCard } from 'components/landing/GuideCard' export const GuideCards = () => { const router = useRouter() const { currentCategory } = useMainContext() - const { guideCards } = useProductLandingContext() + const { guideCards, hasGuidesPage } = useProductLandingContext() const routePath = `/${router.locale}${router.asPath.split('?')[0]}` // remove query string if (!guideCards) { @@ -25,7 +25,7 @@ export const GuideCards = () => { })} - {!currentCategory && ( + {!currentCategory && hasGuidesPage && ( Explore guides diff --git a/layouts/product-landing.html b/layouts/product-landing.html index b648a265f2..a52998f856 100644 --- a/layouts/product-landing.html +++ b/layouts/product-landing.html @@ -56,7 +56,9 @@
    @@ -141,7 +143,9 @@ {% unless currentCategory %} + {% if page.children contains "/guides" %} Explore guides {% octicon "arrow-right" %} + {% endif %} {% endunless %} From f91126998f2d2df547b14c4adf04823cb61294a9 Mon Sep 17 00:00:00 2001 From: Lucas Costi Date: Tue, 15 Jun 2021 10:14:07 +1000 Subject: [PATCH 2/2] Update contrib mentions of headings after H3->H2 content migration (#19884) --- content/README.md | 6 +++--- contributing/content-model.md | 4 ++-- contributing/content-style-guide.md | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/content/README.md b/content/README.md index c00a6e01ab..233d4bc9b9 100644 --- a/content/README.md +++ b/content/README.md @@ -181,7 +181,7 @@ featuredLinks: ### `miniTocMaxHeadingLevel` - Purpose: Indicates the maximum heading level to include in an article's mini TOC. See [Autogenerated mini TOCs](#autogenerated-mini-tocs) for more info. -- Type: `Number`. Default is `3`. Minimum is `2`. Maximum is `4`. +- Type: `Number`. Default is `2`. Minimum is `2`. Maximum is `3`. - Optional. ### `allowTitleToDifferFromFilename` @@ -275,9 +275,9 @@ As an alternative, you can change the single quotes surrounding the frontmatter ## 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 `H2`s and `H3`s in the article by default. +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 `H2`s in the article by default. -* To make the mini TOC include additional (or fewer) heading levels, you can add [`miniTocMaxHeadingLevel` frontmatter](#miniTocMaxHeadingLevel) to specify the maximum heading level. For example: `miniTocMaxHeadingLevel: 4` +* To make the mini TOC include additional (or fewer) heading levels, you can add [`miniTocMaxHeadingLevel` frontmatter](#miniTocMaxHeadingLevel) 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`](#showMiniToc) Mini TOCs do not appear on product landing pages, category landing pages, or map topic pages. diff --git a/contributing/content-model.md b/contributing/content-model.md index b2cb4d4f5b..9582b33b7b 100644 --- a/contributing/content-model.md +++ b/contributing/content-model.md @@ -164,8 +164,8 @@ Use the [referential content template](https://github.com/github/docs/blob/main/ - For subjects with multiple elements to explain, use a table - Example: [Repository permission levels for an organization](https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-permission-levels-for-an-organization) - For longer referential content, such as YAML syntax for workflows, use headers consistently: - - H3 headers for each distinct section - - H4 headers for subsections, such as examples + - H2 headers for each distinct section + - H3 headers for subsections, such as examples - Example: [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions) #### Titles for referential content diff --git a/contributing/content-style-guide.md b/contributing/content-style-guide.md index 1de0b40f2c..e6fe16404f 100644 --- a/contributing/content-style-guide.md +++ b/contributing/content-style-guide.md @@ -156,7 +156,7 @@ Workflow runs are delayed when too many workflows run at once. Since many users ## Headers -Use H3 for headers, and H4 for subheaders. When referring to headers, surround the header name with quotation marks. +Use H2 for headers, and H3 for subheaders. When referring to headers, surround the header name with quotation marks. - **Use:** Under “User licenses”, view your total licenses. To orient readers and help them understand if the section is relevant to them, include introductory content after a header - don’t locate a subheader directly following a header. @@ -217,7 +217,7 @@ For plain text, use linebreaks to separate paragraphs in the source (two consecu Introduce links consistently using a standard format that clearly indicates where we’re linking: "For more information, see X [or "Page/article title"] in the X documentation." Do not include quotation marks within a hyperlink. -Links should be meaningful and provide high value to the user’s journey - link out carefully. Move links that are helpful but not necessary to an article’s further reading section. Do not repeat the same link more than once in the same article or under the same H3 header. +Links should be meaningful and provide high value to the user’s journey - link out carefully. Move links that are helpful but not necessary to an article’s further reading section. Do not repeat the same link more than once in the same article or under the same H2 header. For accessibility and readability, avoid inline or midsentence links. - **Use:** OAuth2 tokens can be acquired programmatically for applications that are not websites. For more information, see "[Setting up and registering OAuth Apps](https://developer.github.com/apps/building-integrations/setting-up-and-registering-oauth-apps/)" and "[Create a new authorization](https://docs.github.com/en/enterprise-server@2.22/rest/reference/oauth-authorizations/#create-a-new-authorization)."