feat(guide): add footer link to article source on GitHub
fix/suggested-changes
This commit is contained in:
12
client/utils/getGithubPath.js
Normal file
12
client/utils/getGithubPath.js
Normal file
@@ -0,0 +1,12 @@
|
||||
exports.getGithubPath = function getGithubPath(fileAbsolutePath) {
|
||||
const { NODE_ENV: env } = process.env;
|
||||
const guideType = env === 'production' ? 'guide' : 'mock-guide';
|
||||
let githubFilePath =
|
||||
'https://github.com/freeCodeCamp/freeCodeCamp/blob/master/CONTRIBUTING.md#research-write-and-update-our-guide-articles';
|
||||
const pathIndex = fileAbsolutePath.indexOf(`/${guideType}`);
|
||||
if (pathIndex > -1) {
|
||||
const newPath = fileAbsolutePath.slice(pathIndex);
|
||||
githubFilePath = `https://github.com/freeCodeCamp/freeCodeCamp/blob/master${newPath}`;
|
||||
}
|
||||
return githubFilePath;
|
||||
};
|
Reference in New Issue
Block a user