Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repo sync #4416

Merged
merged 2 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 47 additions & 14 deletions content/github/getting-started-with-github/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Getting started with GitHub
shortTitle: Getting started
intro: 'Learn about {% data variables.product.prodname_dotcom %}''s products, sign up for an account, and explore the {% data variables.product.prodname_dotcom %} community.'
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.'
redirect_from:
- /categories/54/articles/
- /categories/bootcamp/
Expand All @@ -16,8 +16,34 @@ versions:
free-pro-team: '*'
enterprise-server: '*'
github-ae: '*'
layout: product-landing
introLinks:
quickstart: /github/getting-started-with-github/quickstart
featuredLinks:
guides:
- /github/getting-started-with-github/githubs-products
- /github/getting-started-with-github/create-a-repo
- /github/getting-started-with-github/signing-up-for-a-new-github-account
popular:
- /github/getting-started-with-github/set-up-git
- /github/getting-started-with-github/github-glossary
- /github/getting-started-with-github/fork-a-repo
- /github/getting-started-with-github/keyboard-shortcuts
- /github/getting-started-with-github/saving-repositories-with-stars
guideCards:
- /github/getting-started-with-github/types-of-github-accounts
- /github/getting-started-with-github/finding-ways-to-contribute-to-open-source-on-github
- /github/getting-started-with-github/troubleshooting-connectivity-problems
---

<div hidden>

<!-- {% link_with_intro /quickstart %} -->
<!-- {% link_with_intro /learning-about-github %} -->
<!-- {% link_with_intro /signing-up-for-github %} -->
<!-- {% link_with_intro /exploring-projects-on-github %} -->
<!-- {% link_with_intro /using-github %} -->


### Table of Contents

Expand All @@ -26,29 +52,36 @@ versions:
{% link_in_list /create-a-repo %}
{% link_in_list /fork-a-repo %}
{% link_in_list /be-social %}
{% link_in_list /github-glossary %}
{% link_in_list /git-cheatsheet %}
{% link_in_list /git-and-github-learning-resources %}

{% topic_link_in_list /learning-about-github %}
{% link_in_list /githubs-products %}
{% link_in_list /about-github-advanced-security %}
{% link_in_list /exploring-early-access-releases-with-feature-preview %}
{% link_in_list /types-of-github-accounts %}
{% link_in_list /types-of-github-accounts %}
{% link_in_list /access-permissions-on-github %}
{% link_in_list /faq-about-changes-to-githubs-plans %}
{% link_in_list /github-cli %}
{% link_in_list /github-desktop %}
{% link_in_list /github-for-mobile %}
{% link_in_list /access-permissions-on-github %}
{% link_in_list /github-glossary %}
{% link_in_list /git-cheatsheet %}
{% link_in_list /git-and-github-learning-resources %}


{% topic_link_in_list /signing-up-for-github %}
{% link_in_list /signing-up-for-a-new-github-account %}
{% link_in_list /verifying-your-email-address %}
{% link_in_list /setting-up-a-trial-of-github-enterprise-cloud %}
{% link_in_list /setting-up-a-trial-of-github-enterprise-server %}

{% topic_link_in_list /using-github %}
{% link_in_list /exploring-early-access-releases-with-feature-preview %}
{% link_in_list /supported-browsers %}
{% link_in_list /github-cli %}
{% link_in_list /github-desktop %}
{% link_in_list /github-for-mobile %}
{% link_in_list /keyboard-shortcuts %}
{% link_in_list /troubleshooting-connectivity-problems %}

{% topic_link_in_list /exploring-projects-on-github %}
{% link_in_list /finding-ways-to-contribute-to-open-source-on-github %}
{% link_in_list /saving-repositories-with-stars %}
{% link_in_list /following-people %}
{% topic_link_in_list /using-github %}
{% link_in_list /supported-browsers %}
{% link_in_list /troubleshooting-connectivity-problems %}
{% link_in_list /keyboard-shortcuts %}

</div>
32 changes: 32 additions & 0 deletions includes/all-articles-category.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% assign category = siteTree[currentLanguage][currentVersion].products[currentProduct].categories[currentPath] %}

{% assign maxArticles = 10 %}

<div class="py-6 all-articles-list">
<h2 class="font-mktg mb-4">{{ category.title }} docs</h2>

<div class="d-flex gutter flex-wrap">
{% for xmaptopic in category.maptopics %}
{% assign maptopic = xmaptopic[1] %}
{% unless maptopic.hidden %}
<div class="col-12 col-lg-4 mb-6 height-full">
<h4 class="mb-3"><a href="{{ maptopic.href }}">{{ maptopic.title }}</a></h4>
<ul class="list-style-none">
{% for xarticle in maptopic.articles %}
{% assign article = xarticle[1] %}
<li class="mb-3 {% if forloop.index > maxArticles %}d-none{% endif %}">
<a href="{{ article.href }}">
{{ article.title }}
</a>
</li>
{% endfor %}
{% assign numArticles = maptopic.childArticles | obj_size %}
{% if numArticles > maxArticles %}
<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>
{% endif %}
</ul>
</div>
{% endunless %}
{% endfor %}
</div>
</div>
File renamed without changes.
14 changes: 11 additions & 3 deletions layouts/product-landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ <h1 class="mb-3 font-mktg">
<div class="col-12 col-lg-{% if page.changelog %}4{% else %}6{% endif %} mb-4 mb-lg-0">
<div class="featured-links-heading mb-4 d-flex flex-items-baseline">
<h3 class="f4 text-normal text-mono text-uppercase color-gray-5">{% data ui.toc.guides %}</h3>
<a href="{{ currentPath }}/guides" class="ml-4">View all {% octicon "arrow-right" height="14" class="v-align-middle" %}</a>
{% unless currentCategory %}
<a href="{{ currentPath }}/guides" class="ml-4">View all {% octicon "arrow-right" height="14" class="v-align-middle" %}</a>
{% endunless %}
</div>
<ul class="list-style-none">
{% for link in featuredLinks.guides %}
Expand Down Expand Up @@ -125,13 +127,19 @@ <h2 class="font-mktg h1 mb-2">Guides</h2>
{% render guide-card for guideCards as guide %}
</div>

<a href="{{ currentPath }}/guides" class="btn btn-outline float-right">Explore guides {% octicon "arrow-right" %}</a>
{% unless currentCategory %}
<a href="{{ currentPath }}/guides" class="btn btn-outline float-right">Explore guides {% octicon "arrow-right" %}</a>
{% endunless %}
</div>
</div>
{% endif %}

<div class="container-xl px-3 px-md-6 mt-6">
{% include all-articles %}
{% if currentCategory %}
{% include all-articles-category %}
{% else %}
{% include all-articles-product %}
{% endif %}
</div>

<div class="border-top">
Expand Down
17 changes: 17 additions & 0 deletions lib/path-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ function getProductStringFromPath (href) {
: pathParts[1]
}

function getCategoryStringFromPath (href) {
href = getPathWithoutLanguage(href)

if (href === '/') return null

const pathParts = href.split('/')

if (pathParts.includes('early-access')) return null

const productIndex = allProducts[pathParts[2]]
? 2
: 1

return pathParts[productIndex + 1]
}

// Return the corresponding object for the product segment in a path
function getProductObjectFromPath (href) {
const productFromPath = getProductStringFromPath(href)
Expand All @@ -104,5 +120,6 @@ module.exports = {
getVersionStringFromPath,
getVersionObjectFromPath,
getProductStringFromPath,
getCategoryStringFromPath,
getProductObjectFromPath
}
8 changes: 7 additions & 1 deletion middleware/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ const enterpriseServerReleases = require('../lib/enterprise-server-releases')
const allVersions = require('../lib/all-versions')
const allProducts = require('../lib/all-products')
const activeProducts = Object.values(allProducts).filter(product => !product.wip && !product.hidden)
const { getVersionStringFromPath, getProductStringFromPath, getPathWithoutLanguage } = require('../lib/path-utils')
const {
getVersionStringFromPath,
getProductStringFromPath,
getCategoryStringFromPath,
getPathWithoutLanguage
} = require('../lib/path-utils')
const productNames = require('../lib/product-names')
const warmServer = require('../lib/warm-server')
const featureFlags = Object.keys(require('../feature-flags'))
Expand Down Expand Up @@ -31,6 +36,7 @@ module.exports = async function contextualize (req, res, next) {
req.context.currentLanguage = req.language
req.context.currentVersion = getVersionStringFromPath(req.path)
req.context.currentProduct = getProductStringFromPath(req.path)
req.context.currentCategory = getCategoryStringFromPath(req.path)
req.context.allProducts = allProducts
req.context.activeProducts = activeProducts
req.context.allVersions = allVersions
Expand Down
4 changes: 2 additions & 2 deletions tests/rendering/breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ describe('breadcrumbs', () => {
})

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

test('localized breadcrumbs link to localize pages', async () => {
const $ = await getDOM('/ja/github/getting-started-with-github')
const $ = await getDOM('/ja/github/setting-up-and-managing-your-github-user-account')
const $breadcrumbs = $('.breadcrumbs a')
expect($breadcrumbs.eq(0).attr('href')).toBe('/ja/github')
})
Expand Down
6 changes: 3 additions & 3 deletions tests/rendering/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,15 +756,15 @@ describe('static routes', () => {
})

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

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

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

Expand Down