diff --git a/lib/check-if-next-version-only.js b/lib/check-if-next-version-only.js index 8c20e4013e..beb0d9d2c0 100644 --- a/lib/check-if-next-version-only.js +++ b/lib/check-if-next-version-only.js @@ -1,14 +1,17 @@ import { next, latest } from './enterprise-server-releases.js' import versionSatisfiesRange from './version-satisfies-range.js' -// Special handling for frontmatter that evalues to the next GHES release number or a hardcoded `next`: -// we don't want to return it as an applicable version or it will become a permalink, -// but we also don't want to throw an error if no other versions are found. +// Special handling for frontmatter that evalues to the next GHES release number, +// GHAE `issue-\d{4}` or a hardcoded `next`. We don't want to return any of these +// as an applicable version or it will become a permalink, but we also don't want +// to throw an error if no other versions are found. export default function checkIfNextVersionOnly(value) { if (value === '*') return false - const ghesNextVersionOnly = + const ghesNextVersion = versionSatisfiesRange(next, value) && !versionSatisfiesRange(latest, value) - return ghesNextVersionOnly || value === 'next' + const ghaeUpcomingVersion = value.includes('issue-') + + return ghesNextVersion || ghaeUpcomingVersion || value === 'next' } diff --git a/lib/get-applicable-versions.js b/lib/get-applicable-versions.js index 4cbb970446..bd78102a58 100644 --- a/lib/get-applicable-versions.js +++ b/lib/get-applicable-versions.js @@ -73,7 +73,7 @@ function getApplicableVersions(frontmatterVersions, filepath) { !foundFeatureVersions.isNextVersionOnly ) { throw new Error( - `No applicable versions found for ${filepath}. Please double-check the page's \`versions\` frontmatter.` + `${filepath} is not available in any currently supported version. Make sure the \`versions\` property includes at least one supported version.` ) } diff --git a/middleware/contextualizers/features.js b/middleware/contextualizers/features.js index 9e44ee0526..bdb2eb3fa2 100644 --- a/middleware/contextualizers/features.js +++ b/middleware/contextualizers/features.js @@ -6,7 +6,7 @@ export default function features(req, res, next) { // Determine whether the currentVersion belongs to the list of versions the feature is available in. Object.keys(req.context.site.data.features).forEach((featureName) => { const { versions } = req.context.site.data.features[featureName] - const applicableVersions = getApplicableVersions(versions, req.path) + const applicableVersions = getApplicableVersions(versions, `data/features/${featureName}.yml`) // Adding the resulting boolean to the context object gives us the ability to use // `{% if featureName ... %}` conditionals in content files.