Skip to content

Commit a5cdc5e

Browse files
authored
Merge pull request #5407 from github/repo-sync
repo sync
2 parents 4cd973d + 3263e0a commit a5cdc5e

20 files changed

Lines changed: 145 additions & 127 deletions

File tree

content/actions/index.md

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,4 @@ versions:
4646
<!-- {% link_with_intro /creating-actions %} -->
4747
<!-- {% link_with_intro /using-github-hosted-runners %} -->
4848
<!-- {% link_with_intro /hosting-your-own-runners %} -->
49-
<!-- {% link_with_intro /reference %} -->
50-
51-
<!-- Code examples -->
52-
{% assign actionsCodeExamples = site.data.variables.action_code_examples %}
53-
{% if actionsCodeExamples %}
54-
<div class="my-6 pt-6">
55-
<h2 class="mb-2 font-mktg h1">Code examples</h2>
56-
57-
<div class="pr-lg-3 mb-5 mt-3">
58-
<input class="js-filter-card-filter input-lg py-2 px-3 col-12 col-lg-8 form-control" placeholder="Search code examples" type="search" autocomplete="off" aria-label="Search code examples"/>
59-
</div>
60-
61-
<div class="d-flex flex-wrap gutter">
62-
{% render code-example-card for actionsCodeExamples as example %}
63-
</div>
64-
65-
<button class="js-filter-card-show-more btn btn-outline float-right" data-js-filter-card-max="6">Show more {% octicon "arrow-right" %}</button>
66-
67-
<div class="js-filter-card-no-results d-none py-4 text-center color-text-secondary font-mktg">
68-
<div class="mb-3">{% octicon "search" width="24" %}</div>
69-
<h3 class="text-normal">Sorry, there is no result for <strong class="js-filter-card-value"></strong></h3>
70-
<p class="my-3 f4">It looks like we don't have an example that fits your filter.<br>Try another filter or add your code example</p>
71-
<a href="https://github.com/github/docs/blob/main/data/variables/action_code_examples.yml">Learn how to add a code example {% octicon "arrow-right" %}</a>
72-
</div>
73-
</div>
74-
{% endif %}
49+
<!-- {% link_with_intro /reference %} -->

content/discussions/index.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,3 @@ versions:
3434
<!-- {% link_with_intro /discussions-guides %} -->
3535
<!-- {% link_with_intro /collaborating-with-your-community-using-discussions %} -->
3636
<!-- {% link_with_intro /managing-discussions-for-your-community %} -->
37-
38-
<!-- Community examples -->
39-
{% assign discussionsCommunityExamples = site.data.variables.discussions_community_examples %}
40-
{% if discussionsCommunityExamples %}
41-
<div class="my-6 pt-6">
42-
<h2 class="mb-2 font-mktg h1">Communities using discussions</h2>
43-
44-
<div class="d-flex flex-wrap gutter">
45-
{% render discussions-community-card for discussionsCommunityExamples as example %}
46-
</div>
47-
{% if discussionsCommunityExamples.length > 6 %}
48-
<button class="js-filter-card-show-more btn btn-outline float-right" data-js-filter-card-max="6">Show more {% octicon "arrow-right" %}</button>
49-
{% endif %}
50-
<div class="js-filter-card-no-results d-none py-4 text-center color-text-secondary font-mktg">
51-
<div class="mb-3">{% octicon "search" width="24" %}</div>
52-
<h3 class="text-normal">Sorry, there is no result for <strong class="js-filter-card-value"></strong></h3>
53-
<p class="my-3 f4">It looks like we don't have an example that fits your filter.<br>Try another filter or add your code example</p>
54-
<a href="https://github.com/github/docs/blob/main/data/variables/discussions_community_examples.yml">Add your community {% octicon "arrow-right" %}</a>
55-
</div>
56-
</div>
57-
{% endif %}

data/ui.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@ product_landing:
140140
quick_start: Quickstart
141141
reference_guides: Reference guides
142142
overview: Overview
143+
code_examples: Code examples
144+
search_code_examples: Search code examples
145+
show_more: Show more
146+
sorry: Sorry, there is no result for
147+
no_example: It looks like we don't have an example that fits your filter.
148+
try_another: Try another filter or add your code example.
149+
no_result: Sorry, there is no guide that match your filter.
150+
learn: Learn how to add a code example
151+
communities_using_discussions: Communities using discussions
152+
add_your_community: Add your community
143153
product_sublanding:
144154
start: Start
145155
start_path: Start path
@@ -149,7 +159,6 @@ product_sublanding:
149159
more_guides: more guides
150160
load_more: Load more guides
151161
all_guides: 'All {{ productMap[currentProduct].name }} guides'
152-
no_result: Sorry, there is no guide that match your filter.
153162
filters:
154163
type: Type
155164
topic: Topic

includes/code-examples.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<div class="my-6 pt-6">
2+
<h2 class="mb-2 font-mktg h1">{% data ui.product_landing.code_examples %}</h2>
3+
4+
<div class="pr-lg-3 mb-5 mt-3">
5+
<input class="js-filter-card-filter input-lg py-2 px-3 col-12 col-lg-8 form-control" placeholder="{% data ui.product_landing.search_code_examples %}" type="search" autocomplete="off" aria-label="Search code examples"/>
6+
</div>
7+
8+
<div class="d-flex flex-wrap gutter">
9+
{% render code-example-card for productCodeExamples as example %}
10+
</div>
11+
12+
<button class="js-filter-card-show-more btn btn-outline float-right" data-js-filter-card-max="6">{% data ui.product_landing.show_more %} {% octicon "arrow-right" %}</button>
13+
14+
<div class="js-filter-card-no-results d-none py-4 text-center color-text-secondary font-mktg">
15+
<div class="mb-3">{% octicon "search" width="24" %}</div>
16+
<h3 class="text-normal">{% data ui.product_landing.sorry %} <strong class="js-filter-card-value"></strong></h3>
17+
<p class="my-3 f4">{% data ui.product_landing.no_result %}<br>{% data ui.product_landing.try_another %}</p>
18+
<a href="https://github.com/github/docs/blob/main/data/variables/actions_code_examples.yml">{% data ui.product_landing.learn %} {% octicon "arrow-right" %}</a>
19+
</div>
20+
</div>

includes/community-examples.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<div class="my-6 pt-6">
2+
<h2 class="mb-2 font-mktg h1">{% data ui.product_landing.communities_using_discussions %}</h2>
3+
4+
<div class="d-flex flex-wrap gutter">
5+
{% render discussions-community-card for productCommunityExamples as example %}
6+
</div>
7+
{% if productCommunityExamples.length > 6 %}
8+
<button class="js-filter-card-show-more btn btn-outline float-right" data-js-filter-card-max="6">{% data ui.product_landing.show_more %} {% octicon "arrow-right" %}</button>
9+
{% endif %}
10+
<div class="js-filter-card-no-results d-none py-4 text-center color-text-secondary font-mktg">
11+
<div class="mb-3">{% octicon "search" width="24" %}</div>
12+
<h3 class="text-normal">{% data ui.product_landing.sorry %} <strong class="js-filter-card-value"></strong></h3>
13+
<p class="my-3 f4">{% data ui.product_landing.no_example %} <br>{% data ui.product_landing.try_another %}</p>
14+
<a href="https://github.com/github/docs/blob/main/data/variables/discussions_community_examples.yml">{% data ui.product_landing.add_your_community %} {% octicon "arrow-right" %}</a>
15+
</div>
16+
</div>

includes/sidebar-specific-product.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919
{% capture fullPathToCategory %}{{category[1].href}}{% endcapture %}
2020

2121
<li class="sidebar-category py-1 {% if breadcrumbs.category.href == category[1].href %}active {% if currentPath == fullPathToCategory %}is-current-page {% endif %}{% endif %}{% if category[1].standalone %}standalone-category{% endif %}">
22+
{% if category[1].shortTitle %}{% assign categoryTitle = category[1].shortTitle %}{% else %}{% assign categoryTitle = category[1].title %}{% endif %}
2223
{% if category[1].standalone %}
23-
<a href="{{fullPathToCategory}}" class="pl-4 pr-2 py-2 f6 text-uppercase d-block flex-auto mr-3">{{ category[1].title }}</a>
24+
<a href="{{fullPathToCategory}}" class="pl-4 pr-2 py-2 f6 text-uppercase d-block flex-auto mr-3">{{ categoryTitle }}</a>
2425
{% else %}
2526
<details class="dropdown-withArrow details details-reset" {% if breadcrumbs.category.href == category[1].href or forloop.index < 4 %}open{% endif %}>
2627
<summary>
2728
<div class="d-flex flex-justify-between">
28-
<a href="{{fullPathToCategory}}" class="pl-4 pr-2 py-2 f6 text-uppercase d-block flex-auto mr-3">{{ category[1].title }}</a>
29+
<a href="{{fullPathToCategory}}" class="pl-4 pr-2 py-2 f6 text-uppercase d-block flex-auto mr-3">{{ categoryTitle }}</a>
2930
{% if breadcrumbs.category.href == category[1].href or forloop.index < 4 %}
3031
<svg xmlns="http://www.w3.org/2000/svg" class="octicon flex-shrink-0 arrow mr-3" style="margin-top:7px" viewBox="0 0 16 16" width="16" height="16"> <path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></svg>
3132
{% endif %}
@@ -39,16 +40,18 @@
3940
{% for maptopic in category[1].maptopics %}
4041
{% unless maptopic[1].hidden %}
4142
{% capture fullPathToMaptopic %}{{maptopic[1].href}}{% endcapture %}
43+
{% if maptopic[1].shortTitle %}{% assign maptopicTitle = maptopic[1].shortTitle %}{% else %}{% assign maptopicTitle = maptopic[1].title %}{% endif %}
4244

4345
<li class="sidebar-maptopic {% if breadcrumbs.maptopic.href == maptopic[1].href %}active {% if currentPath == fullPathToMaptopic %}is-current-page{% endif %}{% endif %}">
44-
<a href="{{fullPathToMaptopic}}" class="pl-4 pr-5 py-2">{{ maptopic[1].title }}</a>
46+
<a href="{{fullPathToMaptopic}}" class="pl-4 pr-5 py-2">{{ maptopicTitle }}</a>
4547
<ul class="sidebar-articles my-2">
4648
{% for article in maptopic[1].articles %}
4749
{% unless article[1].hidden %}
4850
{% capture fullPathToArticle %}{{article[1].href}}{% endcapture %}
51+
{% if article[1].shortTitle %}{% assign articleTitle = article[1].shortTitle %}{% else %}{% assign articleTitle = article[1].title %}{% endif %}
4952

5053
<li class="sidebar-article {% if breadcrumbs.article.href == article[1].href %}active {% if currentPath == fullPathToArticle %}is-current-page{% endif %}{% endif %}">
51-
<a href="{{fullPathToArticle}}" class="pl-6 pr-5 py-1{% if forloop.last %} pb-2{% endif %}">{{ article[1].title }}</a>
54+
<a href="{{fullPathToArticle}}" class="pl-6 pr-5 py-1{% if forloop.last %} pb-2{% endif %}">{{ articleTitle }}</a>
5255
</li>
5356
{% endunless %}
5457
{% endfor %}
@@ -63,8 +66,9 @@
6366
{% for article in category[1].articles %}
6467
{% unless article[1].hidden %}
6568
{% capture fullPathToArticle %}{{article[1].href}}{% endcapture %}
69+
{% if article[1].shortTitle %}{% assign articleTitle = article[1].shortTitle %}{% else %}{% assign articleTitle = article[1].title %}{% endif %}
6670
<li class="sidebar-article {% if breadcrumbs.article.href == article[1].href %}active {% if currentPath == fullPathToArticle %}is-current-page{% endif %}{% endif %}">
67-
<a href="{{fullPathToArticle}}" class="pl-4 pr-5 py-1{% if forloop.last %} pb-2{% endif %}">{{ article[1].title }}</a>
71+
<a href="{{fullPathToArticle}}" class="pl-4 pr-5 py-1{% if forloop.last %} pb-2{% endif %}">{{ articleTitle }}</a>
6872
</li>
6973
{% endunless %}
7074
{% endfor %}

layouts/product-landing.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ <h4>{{ link.title }} <span class="Bump-link-symbol">→</span></h4>
117117
{% endif %}
118118
</div>
119119

120+
{% if productCodeExamples %}
121+
{% include code-examples %}
122+
{% endif %}
123+
124+
{% if productCommunityExamples %}
125+
{% include community-examples %}
126+
{% endif %}
127+
120128
{{ renderedPage }}
121129
</div>
122130

lib/site-tree-titles.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ const flat = require('flat')
22
const renderContent = require('./render-content')
33
const delimiter = '#'
44

5-
// render localized and product-version-aware page title
6-
// note this only supports titles with liquid, not short titles
5+
// render localized and product-version-aware page title or shortTitle
76

87
module.exports = async function siteTreeTitles (siteTree, siteData) {
98
// use a non-period delimiter because versions contain periods (like 2.19)
109
const flatTree = flat(siteTree, { delimiter: delimiter })
1110

1211
const titlesWithLiquid = Object.entries(flatTree)
13-
.filter(([path, title]) => path.endsWith('title') && title.includes('{'))
12+
.filter(([path, shortOrLongTitle]) => path.endsWith('itle') && shortOrLongTitle && shortOrLongTitle.includes('{'))
1413

15-
await Promise.all(titlesWithLiquid.map(async ([path, title]) => {
16-
path = path.replace(`${delimiter}title`, '') // ignore the `title` path part for now
14+
await Promise.all(titlesWithLiquid.map(async ([path, shortOrLongTitle]) => {
15+
const isShortTitle = /shortTitle$/.test(path)
16+
17+
path = path.replace(`${delimiter}(shortT|t)itle`, '') // ignore the `title` path part for now
1718

1819
// derive values from path parts
1920
const [
@@ -31,29 +32,39 @@ module.exports = async function siteTreeTitles (siteTree, siteData) {
3132

3233
// create context object for rendering of dynamic liquid data in page titles
3334
const ctx = {
34-
page: { version },
35+
currentVersion: version,
3536
site: siteData[languageCode].site
3637
}
3738

38-
const renderedTitle = await renderContent(title, ctx, { textOnly: true })
39+
const renderedShortOrLongTitle = await renderContent(shortOrLongTitle, ctx, { textOnly: true })
3940

4041
// no product titles have liquid because we get them from lib/all-products.js
4142
// so we can assume all titles processed here will be either a category, maptopic, or article
4243
// we can also assume a category value will exist for any of these
4344
const currentCategory = siteTree[languageCode][version][products][product][categories][category]
4445

45-
if (!maptopic) currentCategory.title = renderedTitle
46+
if (!maptopic) {
47+
isShortTitle
48+
? currentCategory.shortTitle = renderedShortOrLongTitle
49+
: currentCategory.title = renderedShortOrLongTitle
50+
}
4651

4752
let currentMaptopic
4853
if (maptopic) {
4954
currentMaptopic = currentCategory[maptopics][maptopic]
50-
if (!article) currentMaptopic.title = renderedTitle
55+
if (!article) {
56+
isShortTitle
57+
? currentMaptopic.shortTitle = renderedShortOrLongTitle
58+
: currentMaptopic.title = renderedShortOrLongTitle
59+
}
5160
}
5261

5362
let currentArticle
5463
if (article) {
5564
currentArticle = currentMaptopic[articles][article]
56-
currentArticle.title = renderedTitle
65+
isShortTitle
66+
? currentArticle.shortTitle = renderedShortOrLongTitle
67+
: currentArticle.title = renderedShortOrLongTitle
5768
}
5869
}))
5970
}

lib/site-tree.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ function buildCategoriesTree (tocItems, versionedProductHref, pageMap, redirects
7878
if (!page) return
7979
if (!getApplicableVersions(page.versions).includes(version)) return
8080

81-
category.title = page.shortTitle || page.title
81+
category.title = page.title
82+
category.shortTitle = page.shortTitle
8283

8384
// support standalone pages at the category level, like actions/quickstart.md
8485
if (!page.tocItems) {
@@ -157,7 +158,8 @@ function buildArticlesTree (tocItems, versionedCategoryHref, pageMap, redirects,
157158
if (!page) return
158159
if (!getApplicableVersions(page.versions).includes(version)) return
159160

160-
article.title = page.shortTitle || page.title
161+
article.title = page.title
162+
article.shortTitle = page.shortTitle
161163
article.hidden = page.hidden
162164

163165
articleTree[article.href] = article

0 commit comments

Comments
 (0)