1
0
mirror of synced 2025-12-22 11:26:57 -05:00
Files
docs/lib/redirects/add-redirect-to-frontmatter.js
Vanessa Yuen 3df90fc9b8 Hello git history spelunker!
Are you looking for something? Here is all of the GitHub Docs history in one single commit. Enjoy! 🎉
2020-09-27 14:10:11 +02:00

15 lines
463 B
JavaScript

// add a new redirect string to redirect_from frontmatter
module.exports = function addRedirectToFrontmatter (redirectFromData, newRedirectString) {
if (Array.isArray(redirectFromData)) {
redirectFromData.push(newRedirectString)
} else if (typeof redirectFromData === 'string') {
redirectFromData = [redirectFromData]
redirectFromData.push(newRedirectString)
} else {
redirectFromData = [newRedirectString]
}
return redirectFromData
}