Merge branch 'main' of github.com:github/docs-internal into remove-legacy-redirects

This commit is contained in:
Sarah Schneider 2021-01-19 17:47:30 -05:00
Родитель 5e1f14ab39 d72cc6d84e
Коммит d060fddc6f
7 изменённых файлов: 15 добавлений и 9 удалений

Просмотреть файл

@ -130,6 +130,12 @@ Library name | Repository
**GitHub API Gem**|[peter-murach/github](https://github.com/peter-murach/github)
**Ghee**|[rauhryan/ghee](https://github.com/rauhryan/ghee)
### Rust
Library name | Repository
|---|---|
**Octocrab**|[XAMPPRocky/octocrab](https://github.com/XAMPPRocky/octocrab)
### Scala
Library name | Repository

Просмотреть файл

@ -67,7 +67,7 @@ function getNewVersionedPath (oldPath, languageCode = '') {
const restOfString = oldPath.replace(patterns.oldEnterprisePath, '')
// Add the language and new version to the product part of the string
return path.join('/', languageCode, newVersion, restOfString)
return path.posix.join('/', languageCode, newVersion, restOfString)
}
module.exports = {

Просмотреть файл

@ -15,7 +15,7 @@ class Permalink {
const permalinkSuffix = this.constructor.relativePathToSuffix(relativePath)
this.href = removeFPTFromPath(path.join('/', languageCode, pageVersion, permalinkSuffix))
this.href = removeFPTFromPath(path.posix.join('/', languageCode, pageVersion, permalinkSuffix))
.replace(patterns.trailingSlash, '$1')
this.pageVersionTitle = allVersions[pageVersion].versionTitle

Просмотреть файл

@ -74,7 +74,7 @@ module.exports = function getDocsPathFromDeveloperPath (oldDeveloperPath, allRed
// old developer routes that include 'enterprise-admin' should always redirect to enterprise server
if (fragment && newPath.includes('/rest/reference/enterprise-admin') && !patterns.enterpriseServer.test(newPath)) {
newPath = path.join('/en', `enterprise-server@${latest}`, getPathWithoutLanguage(getPathWithoutVersion(newPath)))
newPath = path.posix.join('/en', `enterprise-server@${latest}`, getPathWithoutLanguage(getPathWithoutVersion(newPath)))
}
// show an error if the page to be redirected to doesn't exist

Просмотреть файл

@ -36,7 +36,7 @@ module.exports = function generateRedirectsForPermalinks (permalinks, redirectFr
}
// get the old path for the current permalink version
let versionedFrontmatterOldPath = path.join('/', permalink.languageCode, getNewVersionedPath(frontmatterOldPath))
let versionedFrontmatterOldPath = path.posix.join('/', permalink.languageCode, getNewVersionedPath(frontmatterOldPath))
const versionFromPath = getVersionStringFromPath(versionedFrontmatterOldPath)
versionedFrontmatterOldPath = removeFPTFromPath(versionedFrontmatterOldPath.replace(versionFromPath, permalink.pageVersion))

Просмотреть файл

@ -52,7 +52,7 @@ function getNewHref (link, languageCode, version) {
const hrefWithoutLang = getPathWithoutLanguage(href)
// normalize any legacy links so they conform to new link structure
newHref = path.join('/', languageCode, getNewVersionedPath(hrefWithoutLang))
newHref = path.posix.join('/', languageCode, getNewVersionedPath(hrefWithoutLang))
// get the current version from the link
const versionFromHref = getVersionStringFromPath(newHref)

Просмотреть файл

@ -37,7 +37,7 @@ module.exports = async function buildSiteTree (pageMap, site, redirects) {
return
}
product.href = path.join('/', languageCode, item.href)
product.href = path.posix.join('/', languageCode, item.href)
// find the product TOC page so we have access to the TOC items
const page = findPage(item.href, pageMap, redirects)
@ -71,7 +71,7 @@ function buildCategoriesTree (tocItems, versionedProductHref, pageMap, redirects
tocItems.forEach(item => {
const category = {}
category.href = path.join(versionedProductHref, item.href)
category.href = path.posix.join(versionedProductHref, item.href)
// find the category TOC page and get its TOC items
const page = findPage(category.href, pageMap, redirects)
@ -115,7 +115,7 @@ function buildMaptopicsTree (tocItems, versionedCategoryHref, pageMap, redirects
.forEach(item => {
const maptopic = {}
maptopic.href = path.join(versionedCategoryHref, item.href)
maptopic.href = path.posix.join(versionedCategoryHref, item.href)
// find the category TOC page and get its TOC items
const page = findPage(maptopic.href, pageMap, redirects)
@ -150,7 +150,7 @@ function buildArticlesTree (tocItems, versionedCategoryHref, pageMap, redirects,
tocItems.forEach(item => {
const article = {}
article.href = path.join(versionedCategoryHref, item.href)
article.href = path.posix.join(versionedCategoryHref, item.href)
// find the category TOC page and get its TOC items
const page = findPage(article.href, pageMap, redirects)