1
0
mirror of synced 2025-12-23 21:07:12 -05:00

Add landing page for GitHub Enterprise (#19041)

This commit is contained in:
Sarah Schneider
2021-05-12 07:55:32 -04:00
committed by GitHub
parent 30a1225ac1
commit a5d52dcef0
159 changed files with 932 additions and 95 deletions

View File

@@ -76,7 +76,7 @@ async function renderPatchNotes (patch, ctx) {
module.exports = async function enterpriseReleaseNotesContext (req, res, next) {
// The `/release-notes` sub-path
if (!req.path.endsWith('/release-notes')) return next()
if (!(req.path.endsWith('/release-notes') || req.path.endsWith('/admin'))) return next()
// ignore paths that don't have an enterprise version number
if (!patterns.getEnterpriseServerNumber.test(req.path)) return next()
@@ -106,7 +106,11 @@ module.exports = async function enterpriseReleaseNotesContext (req, res, next) {
const release = req.context.site.data['release-notes'][version.replace(/\./g, '-')]
if (!release) return ret
const patches = sortPatchKeys(release, version)
return { ...ret, patches }
const firstPreviousRelease = all[all.findIndex(v => v === version) + 1]
const secondPreviousRelease = all[all.findIndex(v => v === firstPreviousRelease) + 1]
return { ...ret, patches, firstPreviousRelease, secondPreviousRelease }
})
const releaseIndex = supported.findIndex(release => release === requestedVersion)

View File

@@ -3,9 +3,14 @@ const { getRssFeed, getChangelogItems } = require('../../lib/changelog')
module.exports = async function whatsNewChangelog (req, res, next) {
if (!req.context.page) return next()
if (!req.context.page.changelog) return next()
req.context.changelogUrl = req.context.page.changelog.label === 'education'
? 'https://github.blog/category/community/education'
: `https://github.blog/changelog/label/${req.context.page.changelog.label}`
const label = req.context.page.changelog.label
const labelUrls = {
education: 'https://github.blog/category/community/education',
enterprise: 'https://github.blog/category/enterprise/'
}
req.context.changelogUrl = labelUrls[label] || `https://github.blog/changelog/label/${label}`
const feed = await getRssFeed(req.context.changelogUrl)
req.context.whatsNewChangelog = await getChangelogItems(req.context.page.changelog.prefix, feed)