Skip to content

Commit 052a540

Browse files
emilyistoofunkyheiskrlecoursen
authored
Getting started category landing page (#17841)
* Start building out landing page in index file * Add articles * Add a couple more popular articles * Tweak intro to cover more audiences * Add TOC back with new organization * Update content/github/getting-started-with-github/index.md * Category as product guides section * Update breadcrumbs.js * Update server.js * Update product-landing.html * Remove TOC listing * Revert removing TOC * Update index.md * Update index.md * Update content/github/getting-started-with-github/index.md * Apply suggestions from code review Co-authored-by: Laura Coursen <[email protected]> Co-authored-by: Kevin Heis <[email protected]> Co-authored-by: Laura Coursen <[email protected]>
1 parent 9d664ff commit 052a540

File tree

8 files changed

+119
-23
lines changed

8 files changed

+119
-23
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Getting started with GitHub
33
shortTitle: Getting started
4-
intro: 'Learn about {% data variables.product.prodname_dotcom %}''s products, sign up for an account, and explore the {% data variables.product.prodname_dotcom %} community.'
4+
intro: 'Learn how to start building, shipping, and maintaining software with {% data variables.product.prodname_dotcom %}. Explore our products, sign up for an account, and connect with the world''s largest development community.'
55
redirect_from:
66
- /categories/54/articles/
77
- /categories/bootcamp/
@@ -16,8 +16,34 @@ versions:
1616
free-pro-team: '*'
1717
enterprise-server: '*'
1818
github-ae: '*'
19+
layout: product-landing
20+
introLinks:
21+
quickstart: /github/getting-started-with-github/quickstart
22+
featuredLinks:
23+
guides:
24+
- /github/getting-started-with-github/githubs-products
25+
- /github/getting-started-with-github/create-a-repo
26+
- /github/getting-started-with-github/signing-up-for-a-new-github-account
27+
popular:
28+
- /github/getting-started-with-github/set-up-git
29+
- /github/getting-started-with-github/github-glossary
30+
- /github/getting-started-with-github/fork-a-repo
31+
- /github/getting-started-with-github/keyboard-shortcuts
32+
- /github/getting-started-with-github/saving-repositories-with-stars
33+
guideCards:
34+
- /github/getting-started-with-github/types-of-github-accounts
35+
- /github/getting-started-with-github/finding-ways-to-contribute-to-open-source-on-github
36+
- /github/getting-started-with-github/troubleshooting-connectivity-problems
1937
---
2038

39+
<div hidden>
40+
41+
<!-- {% link_with_intro /quickstart %} -->
42+
<!-- {% link_with_intro /learning-about-github %} -->
43+
<!-- {% link_with_intro /signing-up-for-github %} -->
44+
<!-- {% link_with_intro /exploring-projects-on-github %} -->
45+
<!-- {% link_with_intro /using-github %} -->
46+
2147

2248
### Table of Contents
2349

@@ -26,29 +52,36 @@ versions:
2652
{% link_in_list /create-a-repo %}
2753
{% link_in_list /fork-a-repo %}
2854
{% link_in_list /be-social %}
55+
{% link_in_list /github-glossary %}
56+
{% link_in_list /git-cheatsheet %}
57+
{% link_in_list /git-and-github-learning-resources %}
58+
2959
{% topic_link_in_list /learning-about-github %}
3060
{% link_in_list /githubs-products %}
3161
{% link_in_list /about-github-advanced-security %}
32-
{% link_in_list /exploring-early-access-releases-with-feature-preview %}
33-
{% link_in_list /types-of-github-accounts %}
62+
{% link_in_list /types-of-github-accounts %}
63+
{% link_in_list /access-permissions-on-github %}
3464
{% link_in_list /faq-about-changes-to-githubs-plans %}
35-
{% link_in_list /github-cli %}
36-
{% link_in_list /github-desktop %}
37-
{% link_in_list /github-for-mobile %}
38-
{% link_in_list /access-permissions-on-github %}
39-
{% link_in_list /github-glossary %}
40-
{% link_in_list /git-cheatsheet %}
41-
{% link_in_list /git-and-github-learning-resources %}
65+
66+
4267
{% topic_link_in_list /signing-up-for-github %}
4368
{% link_in_list /signing-up-for-a-new-github-account %}
4469
{% link_in_list /verifying-your-email-address %}
4570
{% link_in_list /setting-up-a-trial-of-github-enterprise-cloud %}
4671
{% link_in_list /setting-up-a-trial-of-github-enterprise-server %}
72+
73+
{% topic_link_in_list /using-github %}
74+
{% link_in_list /exploring-early-access-releases-with-feature-preview %}
75+
{% link_in_list /supported-browsers %}
76+
{% link_in_list /github-cli %}
77+
{% link_in_list /github-desktop %}
78+
{% link_in_list /github-for-mobile %}
79+
{% link_in_list /keyboard-shortcuts %}
80+
{% link_in_list /troubleshooting-connectivity-problems %}
81+
4782
{% topic_link_in_list /exploring-projects-on-github %}
4883
{% link_in_list /finding-ways-to-contribute-to-open-source-on-github %}
4984
{% link_in_list /saving-repositories-with-stars %}
5085
{% link_in_list /following-people %}
51-
{% topic_link_in_list /using-github %}
52-
{% link_in_list /supported-browsers %}
53-
{% link_in_list /troubleshooting-connectivity-problems %}
54-
{% link_in_list /keyboard-shortcuts %}
86+
87+
</div>

includes/all-articles-category.html

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{% assign category = siteTree[currentLanguage][currentVersion].products[currentProduct].categories[currentPath] %}
2+
3+
{% assign maxArticles = 10 %}
4+
5+
<div class="py-6 all-articles-list">
6+
<h2 class="font-mktg mb-4">{{ category.title }} docs</h2>
7+
8+
<div class="d-flex gutter flex-wrap">
9+
{% for xmaptopic in category.maptopics %}
10+
{% assign maptopic = xmaptopic[1] %}
11+
{% unless maptopic.hidden %}
12+
<div class="col-12 col-lg-4 mb-6 height-full">
13+
<h4 class="mb-3"><a href="{{ maptopic.href }}">{{ maptopic.title }}</a></h4>
14+
<ul class="list-style-none">
15+
{% for xarticle in maptopic.articles %}
16+
{% assign article = xarticle[1] %}
17+
<li class="mb-3 {% if forloop.index > maxArticles %}d-none{% endif %}">
18+
<a href="{{ article.href }}">
19+
{{ article.title }}
20+
</a>
21+
</li>
22+
{% endfor %}
23+
{% assign numArticles = maptopic.childArticles | obj_size %}
24+
{% if numArticles > maxArticles %}
25+
<button class="js-all-articles-show-more btn-link link-gray">Show {{ numArticles | minus: maxArticles }} more {% octicon "chevron-up" class="v-align-text-bottom" %}</button>
26+
{% endif %}
27+
</ul>
28+
</div>
29+
{% endunless %}
30+
{% endfor %}
31+
</div>
32+
</div>
File renamed without changes.

layouts/product-landing.html

+11-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ <h1 class="mb-3 font-mktg">
6060
<div class="col-12 col-lg-{% if page.changelog %}4{% else %}6{% endif %} mb-4 mb-lg-0">
6161
<div class="featured-links-heading mb-4 d-flex flex-items-baseline">
6262
<h3 class="f4 text-normal text-mono text-uppercase color-gray-5">{% data ui.toc.guides %}</h3>
63-
<a href="{{ currentPath }}/guides" class="ml-4">View all {% octicon "arrow-right" height="14" class="v-align-middle" %}</a>
63+
{% unless currentCategory %}
64+
<a href="{{ currentPath }}/guides" class="ml-4">View all {% octicon "arrow-right" height="14" class="v-align-middle" %}</a>
65+
{% endunless %}
6466
</div>
6567
<ul class="list-style-none">
6668
{% for link in featuredLinks.guides %}
@@ -125,13 +127,19 @@ <h2 class="font-mktg h1 mb-2">Guides</h2>
125127
{% render guide-card for guideCards as guide %}
126128
</div>
127129

128-
<a href="{{ currentPath }}/guides" class="btn btn-outline float-right">Explore guides {% octicon "arrow-right" %}</a>
130+
{% unless currentCategory %}
131+
<a href="{{ currentPath }}/guides" class="btn btn-outline float-right">Explore guides {% octicon "arrow-right" %}</a>
132+
{% endunless %}
129133
</div>
130134
</div>
131135
{% endif %}
132136

133137
<div class="container-xl px-3 px-md-6 mt-6">
134-
{% include all-articles %}
138+
{% if currentCategory %}
139+
{% include all-articles-category %}
140+
{% else %}
141+
{% include all-articles-product %}
142+
{% endif %}
135143
</div>
136144

137145
<div class="border-top">

lib/path-utils.js

+17
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,22 @@ function getProductStringFromPath (href) {
9090
: pathParts[1]
9191
}
9292

93+
function getCategoryStringFromPath (href) {
94+
href = getPathWithoutLanguage(href)
95+
96+
if (href === '/') return null
97+
98+
const pathParts = href.split('/')
99+
100+
if (pathParts.includes('early-access')) return null
101+
102+
const productIndex = allProducts[pathParts[2]]
103+
? 2
104+
: 1
105+
106+
return pathParts[productIndex + 1]
107+
}
108+
93109
// Return the corresponding object for the product segment in a path
94110
function getProductObjectFromPath (href) {
95111
const productFromPath = getProductStringFromPath(href)
@@ -104,5 +120,6 @@ module.exports = {
104120
getVersionStringFromPath,
105121
getVersionObjectFromPath,
106122
getProductStringFromPath,
123+
getCategoryStringFromPath,
107124
getProductObjectFromPath
108125
}

middleware/context.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ const enterpriseServerReleases = require('../lib/enterprise-server-releases')
33
const allVersions = require('../lib/all-versions')
44
const allProducts = require('../lib/all-products')
55
const activeProducts = Object.values(allProducts).filter(product => !product.wip && !product.hidden)
6-
const { getVersionStringFromPath, getProductStringFromPath, getPathWithoutLanguage } = require('../lib/path-utils')
6+
const {
7+
getVersionStringFromPath,
8+
getProductStringFromPath,
9+
getCategoryStringFromPath,
10+
getPathWithoutLanguage
11+
} = require('../lib/path-utils')
712
const productNames = require('../lib/product-names')
813
const warmServer = require('../lib/warm-server')
914
const featureFlags = Object.keys(require('../feature-flags'))
@@ -31,6 +36,7 @@ module.exports = async function contextualize (req, res, next) {
3136
req.context.currentLanguage = req.language
3237
req.context.currentVersion = getVersionStringFromPath(req.path)
3338
req.context.currentProduct = getProductStringFromPath(req.path)
39+
req.context.currentCategory = getCategoryStringFromPath(req.path)
3440
req.context.allProducts = allProducts
3541
req.context.activeProducts = activeProducts
3642
req.context.allVersions = allVersions

tests/rendering/breadcrumbs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ describe('breadcrumbs', () => {
4949
})
5050

5151
test('English breadcrumbs link to English pages', async () => {
52-
const $ = await getDOM('/en/github/getting-started-with-github')
52+
const $ = await getDOM('/en/github/setting-up-and-managing-your-github-user-account')
5353
const $breadcrumbs = $('.breadcrumbs a')
5454
expect($breadcrumbs.eq(0).attr('href')).toBe('/en/github')
5555
})
5656

5757
test('localized breadcrumbs link to localize pages', async () => {
58-
const $ = await getDOM('/ja/github/getting-started-with-github')
58+
const $ = await getDOM('/ja/github/setting-up-and-managing-your-github-user-account')
5959
const $breadcrumbs = $('.breadcrumbs a')
6060
expect($breadcrumbs.eq(0).attr('href')).toBe('/ja/github')
6161
})

tests/rendering/server.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -756,15 +756,15 @@ describe('static routes', () => {
756756
})
757757

758758
describe('index pages', () => {
759-
const nonEnterpriseOnlyPath = '/en/github/getting-started-with-github/verifying-your-email-address'
759+
const nonEnterpriseOnlyPath = '/en/github/setting-up-and-managing-your-github-user-account/managing-user-account-settings'
760760

761761
test('includes dotcom-only links in dotcom TOC', async () => {
762-
const $ = await getDOM('/en/github/getting-started-with-github')
762+
const $ = await getDOM('/en/github/setting-up-and-managing-your-github-user-account')
763763
expect($(`article a[href="${nonEnterpriseOnlyPath}"]`).length).toBe(1)
764764
})
765765

766766
test('excludes dotcom-only from GHE TOC', async () => {
767-
const $ = await getDOM(`/en/enterprise/${enterpriseServerReleases.latest}/user/github/getting-started-with-github`)
767+
const $ = await getDOM(`/en/enterprise/${enterpriseServerReleases.latest}/user/github/setting-up-and-managing-your-github-user-account`)
768768
expect($(`a[href="${nonEnterpriseOnlyPath}"]`).length).toBe(0)
769769
})
770770

0 commit comments

Comments
 (0)