Skip to content

Commit 6ee59e5

Browse files
authored
repo sync
2 parents 53ef454 + 311171a commit 6ee59e5

17 files changed

Lines changed: 117 additions & 94 deletions

content/developers/github-marketplace/creating-apps-for-github-marketplace.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ intro: 'You can list free and paid tools for developers to use in {% data variab
44
mapTopic: true
55
versions:
66
free-pro-team: '*'
7-
enterprise-server: '*'
87
---
98

content/github/site-policy/github-insights-and-data-protection-for-your-organization.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ intro: '{% data variables.product.prodname_insights %} analyzes your {% data var
44
product: '{% data reusables.gated-features.github-insights %}'
55
redirect_from:
66
- /github/installing-and-configuring-github-insights/github-insights-and-data-protection-for-your-organization
7+
- /enterprise-server@2.22/github/site-policy/github-insights-and-data-protection-for-your-organization
8+
- /enterprise-server@2.21/github/site-policy/github-insights-and-data-protection-for-your-organization
9+
- /enterprise-server@2.20/github/site-policy/github-insights-and-data-protection-for-your-organization
710
versions:
8-
enterprise-server: '*'
11+
free-pro-team: '*'
912
---
1013

1114
For more information about the terms that govern {% data variables.product.prodname_insights %}, see your {% data variables.product.prodname_ghe_one %} subscription agreement.

content/insights/installing-and-configuring-github-insights/about-data-in-github-insights.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ You can choose which contributors are included in metrics and create teams of co
1919

2020
### Further reading
2121
- "[Metrics available with {% data variables.product.prodname_insights %}](/insights/exploring-your-usage-of-github-enterprise/metrics-available-with-github-insights)"
22-
- "[{% data variables.product.prodname_insights %} and data protection for your organization](/github/site-policy/github-insights-and-data-protection-for-your-organization)"
22+
- "<a href="/github/site-policy/github-insights-and-data-protection-for-your-organization" class="dotcom-only">{% data variables.product.prodname_insights %} and data protection for your organization</a>"

content/insights/installing-and-configuring-github-insights/installing-github-insights.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@ To configure {% data variables.product.prodname_insights %} to connect to {% dat
108108
### Further reading
109109

110110
- "[Managing repositories](/insights/installing-and-configuring-github-insights/managing-repositories)"
111-
- "[{% data variables.product.prodname_insights %} and data protection for your organization](/github/site-policy/github-insights-and-data-protection-for-your-organization)"
111+
- "<a href="/github/site-policy/github-insights-and-data-protection-for-your-organization" class="dotcom-only">{% data variables.product.prodname_insights %} and data protection for your organization</a>"

includes/breadcrumbs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% if breadcrumb[1].href == '' %}
44
<span>{{breadcrumb[1].title}}</span>
55
{% else %}
6-
<a title="{{ breadcrumb[0]}}: {{breadcrumb[1].title}}" href="/{{currentLanguage}}{{breadcrumb[1].href}}" class="d-inline-block {% if breadcrumb[1].href == currentPathWithoutLanguage %}text-gray-light{% endif %}">
6+
<a title="{{ breadcrumb[0]}}: {{breadcrumb[1].title}}" href="{{{breadcrumb[1].href}}" class="d-inline-block {% if breadcrumb[1].href == currentPath %}text-gray-light{% endif %}">
77
{{breadcrumb[1].title}}</a>
88
{% endif %}
99
{% endfor %}

includes/sidebar-guides.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<ul class="sidebar-categories">
22
{% for category in product[1].categories %}
33
<li class="sidebar-category {% if breadcrumbs.category.href == category[1].href %}active{% endif %}">
4-
<a href="/{{currentLanguage}}{{category[1].href}}">{{ category[1].title }}</a>
4+
<a href="{{category[1].href}}">{{ category[1].title }}</a>
55
<!-- some categories have topics with child articles -->
66
{% if category[1].maptopics %}
77
<ul class="sidebar-maptopics">
88
{% for maptopic in category[1].maptopics %}
99
<li class="sidebar-maptopic {% if breadcrumbs.maptopic.href == maptopic[1].href %}active{% endif %}">
10-
<a href="/{{currentLanguage}}{{maptopic[1].href}}">{{ maptopic[1].title }}</a>
10+
<a href="{{maptopic[1].href}}">{{ maptopic[1].title }}</a>
1111
<ul class="sidebar-articles">
1212
{% for article in maptopic[1].articles %}
1313
<li class="sidebar-article {% if currentPath == article[1].href %}active{% endif %}">
14-
<a href="/{{currentLanguage}}{{article[1].href}}">{{ article[1].title }}</a>
14+
<a href="{{article[1].href}}">{{ article[1].title }}</a>
1515
</li>
1616
{% endfor %}
1717
</ul>
@@ -23,7 +23,7 @@
2323
<ul class="sidebar-articles">
2424
{% for article in category[1].articles %}
2525
<li class="sidebar-article{% if currentPath == article[1].href %} active{% endif %}">
26-
<a href="/{{currentLanguage}}{{article[1].href}}">{{ article[1].title }}</a>
26+
<a href="{{article[1].href}}">{{ article[1].title }}</a>
2727
</li>
2828
{% endfor %}
2929
</ul>

includes/sidebar-specific-product.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
{% include all-products-link %}
1111
<li title="{{product.title}}" class="sidebar-product mb-2">
1212
{% unless page.hidden %}
13-
<a href="/{{currentLanguage}}{{product.href}}" class="pl-4 pr-5 pb-1 f4">{{ product.title }}</a>
13+
<a href="{{product.href}}" class="pl-4 pr-5 pb-1 f4">{{ product.title }}</a>
1414
{% endunless %}
1515
</li>
1616
<ul class="sidebar-categories list-style-none">
1717
{% for category in product.categories %}
18-
{% capture fullPathToCategory %}/{{currentLanguage}}{{category[1].href}}{% endcapture %}
18+
{% capture fullPathToCategory %}{{category[1].href}}{% endcapture %}
1919

2020
<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 %}">
2121
{% if category[1].standalone %}
@@ -37,13 +37,13 @@
3737
<ul class="sidebar-topics list-style-none position-relative">
3838
{% for maptopic in category[1].maptopics %}
3939
{% unless maptopic[1].hidden %}
40-
{% capture fullPathToMaptopic %}/{{currentLanguage}}{{maptopic[1].href}}{% endcapture %}
40+
{% capture fullPathToMaptopic %}{{maptopic[1].href}}{% endcapture %}
4141

4242
<li class="sidebar-maptopic {% if breadcrumbs.maptopic.href == maptopic[1].href %}active {% if currentPath == fullPathToMaptopic %}is-current-page{% endif %}{% endif %}">
4343
<a href="{{fullPathToMaptopic}}" class="pl-4 pr-5 py-2">{{ maptopic[1].title }}</a>
4444
<ul class="sidebar-articles my-2">
4545
{% for article in maptopic[1].articles %}
46-
{% capture fullPathToArticle %}/{{currentLanguage}}{{article[1].href}}{% endcapture %}
46+
{% capture fullPathToArticle %}{{article[1].href}}{% endcapture %}
4747

4848
<li class="sidebar-article {% if breadcrumbs.article.href == article[1].href %}active {% if currentPath == fullPathToArticle %}is-current-page{% endif %}{% endif %}">
4949
<a href="{{fullPathToArticle}}" class="pl-6 pr-5 py-1{% if forloop.last %} pb-2{% endif %}">{{ article[1].title }}</a>
@@ -58,7 +58,7 @@
5858
{% else %}
5959
<ul class="sidebar-articles list-style-none">
6060
{% for article in category[1].articles %}
61-
{% capture fullPathToArticle %}/{{currentLanguage}}{{article[1].href}}{% endcapture %}
61+
{% capture fullPathToArticle %}{{article[1].href}}{% endcapture %}
6262
<li class="sidebar-article {% if breadcrumbs.article.href == article[1].href %}active {% if currentPath == fullPathToArticle %}is-current-page{% endif %}{% endif %}">
6363
<a href="{{fullPathToArticle}}" class="pl-4 pr-5 py-1{% if forloop.last %} pb-2{% endif %}">{{ article[1].title }}</a>
6464
</li>

lib/get-map-topic-content.js

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
1-
const findPage = require('./find-page')
1+
const { get, last } = require('lodash')
2+
const { getLanguageCode } = require('../lib/patterns')
23

3-
// get the page.childArticles set on english map topics in lib/site-tree.js
4-
module.exports = function getMapTopicContent (page, pageMap, redirects) {
5-
const englishPage = page.languageCode !== 'en'
6-
? findPage(`/${page.relativePath.replace(/.md$/, '')}`, pageMap, redirects, 'en')
7-
: page
4+
// get the childArticles set on map topics in lib/site-tree.js
5+
module.exports = function getMapTopicContent (productId, siteTree, currentLanguage, currentVersion, currentPath) {
6+
const maptopicPath = currentPath
7+
const categoryPath = currentPath.replace(new RegExp(`/${last(currentPath.split('/'))}$`), '')
8+
const siteTreePath = getSiteTreePath(currentVersion, productId, categoryPath, maptopicPath)
9+
let childArticles = get(siteTree[currentLanguage], siteTreePath)
810

9-
if (!englishPage) {
10-
console.error(`cannot find english page: ${page.fullPath}`)
11-
return
11+
// try falling back to English if needed
12+
if (!childArticles && currentLanguage !== 'en') {
13+
const englishCategoryPath = categoryPath.replace(getLanguageCode, '/en')
14+
const englishMaptopicPath = maptopicPath.replace(getLanguageCode, '/en')
15+
const englishSiteTreePath = getSiteTreePath(currentVersion, productId, englishCategoryPath, englishMaptopicPath)
16+
childArticles = get(siteTree.en, englishSiteTreePath)
1217
}
1318

14-
if (!englishPage.childArticles) {
15-
console.error(`error getting child articles on map topic: ${page.fullPath}`)
16-
return
19+
if (!childArticles) {
20+
console.error(`can't find child articles for map topic ${currentPath}`)
21+
return ''
1722
}
1823

19-
return englishPage.childArticles
24+
return childArticles
2025
.map(article => `{% link_with_intro /${article.href} %}`)
2126
.join('\n\n')
2227
}
28+
29+
function getSiteTreePath (version, productId, categoryPath, maptopicPath) {
30+
return [version, 'products', productId, 'categories', categoryPath, 'maptopics', maptopicPath, 'childArticles']
31+
}

lib/page.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ class Page {
157157
this.shortTitle = await renderContent(this.shortTitle, context, { textOnly: true, encodeEntities: true })
158158

159159
let markdown = this.mapTopic
160-
? getMapTopicContent(this, context.pages, context.redirects)
160+
// get the map topic child articles from the siteTree
161+
? getMapTopicContent(this.parentProduct.id, context.siteTree, context.currentLanguage, context.currentVersion, context.currentPath)
161162
: this.markdown
162163

163164
// If the article is interactive parse the React!

lib/redirects/permalinks.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const patterns = require('../patterns')
22
const { getVersionedPathWithLanguage } = require('../path-utils')
3+
const supportedVersions = new Set(Object.keys(require('../all-versions')))
34
const getOldPathsFromPermalink = require('./get-old-paths-from-permalink')
45

56
module.exports = function generateRedirectsForPermalinks (permalinks, redirectFrontmatter) {
@@ -25,6 +26,12 @@ module.exports = function generateRedirectsForPermalinks (permalinks, redirectFr
2526
// remove trailing slashes (sometimes present in frontmatter)
2627
frontmatterOldPath = frontmatterOldPath.replace(patterns.trailingSlash, '$1')
2728

29+
// support hardcoded versions in redirect frontmatter
30+
if (supportedVersions.has(frontmatterOldPath.split('/')[1])) {
31+
redirects[frontmatterOldPath] = permalink.href
32+
redirects[`/en${frontmatterOldPath}`] = permalink.href
33+
}
34+
2835
// get the old path for the current permalink version
2936
const versionedFrontmatterOldPath = getVersionedPathWithLanguage(frontmatterOldPath, permalink.pageVersion, permalink.languageCode)
3037

0 commit comments

Comments
 (0)