fix(client): proper link to the guide for a hint button

This commit is contained in:
Valeriy
2019-01-15 01:44:42 +03:00
committed by Stuart Taylor
parent 9b75c1965a
commit 261b1e197f
4 changed files with 11 additions and 21 deletions

View File

@ -23,8 +23,8 @@ function NoArticles() {
Could you 
<a
href={
'https://github.com/freeCodeCamp/guides/blob/master/README.md' +
'#freecodecamp-guide'
'https://github.com/freeCodeCamp/freeCodeCamp/blob/master/docs/' +
'how-to-work-on-guide-articles.md#how-to-work-on-guide-articles'
}
rel='noopener noreferrer'
target='_blank'

View File

@ -1,7 +1,7 @@
const guideBase = 'https://guide.freecodecamp.org/certifications';
const guideBase = '/guide/certifications';
export function createGuideUrl(slug = '') {
return guideBase + slug;
return guideBase + slug.replace(/^\/learn\//, '/');
}
export function isGoodXHRStatus(status) {

View File

@ -2,9 +2,7 @@ exports.dasherize = function dasherize(name) {
return ('' + name)
.toLowerCase()
.replace(/\s/g, '-')
.replace(/[^a-z0-9\-.]/gi, '')
.replace(/\./g, '-')
.replace(/:/g, '');
.replace(/[^a-z0-9\-.]/gi, '');
};
exports.nameify = function nameify(str) {

View File

@ -1,6 +1,7 @@
const path = require('path');
const fs = require('fs');
const matter = require('gray-matter');
const { dasherize } = require('../../../client/utils');
const pass = true;
@ -36,22 +37,13 @@ exports.checkGuideFile = function checkGuideFile(file) {
function checkDirName(dirName, fullPath) {
return new Promise((resolve, reject) => {
if (dirName.replace(/(\s|\_)/, '') !== dirName) {
if (dasherize(dirName) !== dirName) {
return reject(
new Error(`
Invalid character found in '${dirName}', please use '-' for spaces
Invalid or upper case character found in '${dirName}', please use '-' for spaces
and all folder names must be lower case. Valid characters are [a-z0-9\\-.].
Found in:
${fullPath}
`)
);
}
if (dirName.toLowerCase() !== dirName) {
return reject(
new Error(`
Upper case characters found in ${dirName}, all folder names must be lower case
Found in :
Found in:
${fullPath}
`)
);
@ -107,7 +99,7 @@ exports.checkFrontmatter = function checkFrontmatter(
} catch (e) {
console.log(`
The below occured in:
The below occurred in:
${fullPath}