зеркало из https://github.com/github/docs.git
remove pageVersionTitle from page context data (#32453)
This commit is contained in:
Родитель
46fbab792e
Коммит
26291a6e52
|
@ -96,7 +96,6 @@ export type MainContextT = {
|
|||
languageCode: string
|
||||
relativePath: string
|
||||
title: string
|
||||
pageVersionTitle: string
|
||||
pageVersion: string
|
||||
href: string
|
||||
}>
|
||||
|
@ -151,14 +150,7 @@ export const getMainContext = async (req: any, res: any): Promise<MainContextT>
|
|||
topics: req.context.page.topics || [],
|
||||
introPlainText: req.context.page?.introPlainText,
|
||||
permalinks: req.context.page?.permalinks.map((obj: any) =>
|
||||
pick(obj, [
|
||||
'title',
|
||||
'pageVersionTitle',
|
||||
'pageVersion',
|
||||
'href',
|
||||
'relativePath',
|
||||
'languageCode',
|
||||
])
|
||||
pick(obj, ['title', 'pageVersion', 'href', 'relativePath', 'languageCode'])
|
||||
),
|
||||
hidden: req.context.page.hidden || false,
|
||||
noEarlyAccessBanner: req.context.page.noEarlyAccessBanner || false,
|
||||
|
|
|
@ -20,8 +20,8 @@ export const VersionPicker = ({ variant }: Props) => {
|
|||
}
|
||||
|
||||
const allLinks = (page.permalinks || []).map((permalink) => ({
|
||||
text: permalink.pageVersionTitle,
|
||||
selected: allVersions[currentVersion].versionTitle === permalink.pageVersionTitle,
|
||||
text: allVersions[permalink.pageVersion].versionTitle,
|
||||
selected: currentVersion === permalink.pageVersion,
|
||||
href: permalink.href,
|
||||
arrow: false,
|
||||
info: false,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import assert from 'assert'
|
||||
import path from 'path'
|
||||
import patterns from './patterns.js'
|
||||
import { allVersions } from './all-versions.js'
|
||||
import removeFPTFromPath from './remove-fpt-from-path.js'
|
||||
|
||||
/*
|
||||
|
@ -15,8 +14,7 @@ page.permalinks is an array of objects that looks like this:
|
|||
"relativePath": "billing/managing-billing-for-your-github-account/index.md",
|
||||
"title": "Managing billing for your GitHub account",
|
||||
"hrefWithoutLanguage": "/billing/managing-billing-for-your-github-account",
|
||||
"href": "/en/billing/managing-billing-for-your-github-account",
|
||||
"pageVersionTitle": "Free, Pro, & Team"
|
||||
"href": "/en/billing/managing-billing-for-your-github-account"
|
||||
},
|
||||
{
|
||||
"languageCode": "en",
|
||||
|
@ -24,8 +22,7 @@ page.permalinks is an array of objects that looks like this:
|
|||
"relativePath": "billing/managing-billing-for-your-github-account/index.md",
|
||||
"title": "Managing billing for your GitHub account",
|
||||
"hrefWithoutLanguage": "/enterprise-cloud@latest/billing/managing-billing-for-your-github-account",
|
||||
"href": "/en/enterprise-cloud@latest/billing/managing-billing-for-your-github-account",
|
||||
"pageVersionTitle": "Enterprise Cloud"
|
||||
"href": "/en/enterprise-cloud@latest/billing/managing-billing-for-your-github-account"
|
||||
}
|
||||
... and so on for each of the content file's supported versions.
|
||||
]
|
||||
|
@ -46,8 +43,6 @@ class Permalink {
|
|||
this.hrefWithoutLanguage === '/' ? '' : this.hrefWithoutLanguage
|
||||
}`
|
||||
|
||||
this.pageVersionTitle = allVersions[pageVersion].versionTitle
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ describe('Permalink class', () => {
|
|||
|
||||
test('derives info for non-enterprise versioned homepage', () => {
|
||||
const permalink = new Permalink('en', nonEnterpriseDefaultVersion, 'index.md', 'Hello World')
|
||||
expect(permalink.pageVersionTitle).toBe('Free, Pro, & Team')
|
||||
expect(permalink.href).toBe('/en')
|
||||
})
|
||||
|
||||
|
@ -38,7 +37,6 @@ describe('Permalink class', () => {
|
|||
'index.md',
|
||||
'Hello World'
|
||||
)
|
||||
expect(permalink.pageVersionTitle).toBe(`Enterprise Server ${enterpriseServerReleases.latest}`)
|
||||
expect(permalink.href).toBe(`/en/enterprise-server@${enterpriseServerReleases.latest}`)
|
||||
})
|
||||
|
||||
|
@ -49,7 +47,6 @@ describe('Permalink class', () => {
|
|||
'github/index.md',
|
||||
'Hello World'
|
||||
)
|
||||
expect(permalink.pageVersionTitle).toBe('Free, Pro, & Team')
|
||||
expect(permalink.href).toBe('/en/github')
|
||||
})
|
||||
|
||||
|
@ -60,7 +57,6 @@ describe('Permalink class', () => {
|
|||
'github/index.md',
|
||||
'Hello World'
|
||||
)
|
||||
expect(permalink.pageVersionTitle).toBe(`Enterprise Server ${enterpriseServerReleases.latest}`)
|
||||
expect(permalink.href).toBe(`/en/enterprise-server@${enterpriseServerReleases.latest}/github`)
|
||||
})
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче