Add landing page for GitHub Enterprise (#19041)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user