15 lines
621 B
JavaScript
15 lines
621 B
JavaScript
const slash = require('slash')
|
|
const patterns = require('./patterns')
|
|
const nonEnterpriseDefaultVersion = require('./non-enterprise-default-version')
|
|
|
|
// This is a convenience function to remove free-pro-team@latest from all
|
|
// **user-facing** aspects of the site (particularly URLs) while continuing to support
|
|
// free-pro-team@latest as a version both in the codebase and in content/data files.
|
|
module.exports = function removeFPTFromPath (path) {
|
|
path = process.env.FEATURE_REMOVE_FPT
|
|
? slash(path.replace(`/${nonEnterpriseDefaultVersion}`, ''))
|
|
: path
|
|
|
|
return path.replace(patterns.trailingSlash, '$1')
|
|
}
|