Skip to content

Commit 980185b

Browse files
committed
Added SEO filename check and updated name of existing tutorials
1 parent 62160a8 commit 980185b

67 files changed

Lines changed: 50 additions & 7 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gruntfile.js

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,47 @@
11
module.exports = function(grunt) {
22

33
grunt.initConfig({
4+
filenames: {
5+
options: {
6+
valid: function(filename) {
7+
var fName = filename.replace('.md', '');
8+
9+
// taken from http://xpo6.com/list-of-english-stop-words/
10+
var stopwords = ['a', 'about', 'above', 'across', 'after', 'afterwards', 'again', 'against', 'all', 'almost', 'alone', 'along', 'already', 'also', 'although', 'always', 'am', 'among', 'amongst', 'amount', 'an', 'and', 'another', 'any', 'anyhow', 'anyone', 'anything', 'anyway', 'anywhere', 'are', 'around', 'as', 'at', 'back', 'be', 'became', 'because', 'become', 'becomes', 'becoming', 'been', 'before', 'beforehand', 'behind', 'being', 'below', 'beside', 'besides', 'between', 'beyond', 'bill', 'both', 'bottom', 'but', 'by', 'call', 'can', 'cannot', 'cant', 'co', 'con', 'could', 'couldnt', 'cry', 'de', 'describe', 'detail', 'do', 'done', 'down', 'due', 'during', 'each', 'eg', 'eight', 'either', 'eleven', 'else', 'elsewhere', 'empty', 'enough', 'etc', 'even', 'ever', 'every', 'everyone', 'everything', 'everywhere', 'except', 'few', 'fifteen', 'fifty', 'fill', 'find', 'fire', 'first', 'five', 'for', 'former', 'formerly', 'forty', 'found', 'four', 'from', 'front', 'full', 'further', 'get', 'give', 'go', 'had', 'has', 'hasnt', 'have', 'he', 'hence', 'her', 'here', 'hereafter', 'hereby', 'herein', 'hereupon', 'hers', 'herself', 'him', 'himself', 'his', 'how', 'however', 'hundred', 'ie', 'if', 'in', 'inc', 'indeed', 'interest', 'into', 'is', 'it', 'its', 'itself', 'keep', 'last', 'latter', 'latterly', 'least', 'less', 'ltd', 'made', 'many', 'may', 'me', 'meanwhile', 'might', 'mill', 'mine', 'more', 'moreover', 'most', 'mostly', 'move', 'much', 'must', 'my', 'myself', 'name', 'namely', 'neither', 'never', 'nevertheless', 'next', 'nine', 'no', 'nobody', 'none', 'noone', 'nor', 'not', 'nothing', 'now', 'nowhere', 'of', 'off', 'often', 'on', 'once', 'one', 'only', 'onto', 'or', 'other', 'others', 'otherwise', 'our', 'ours', 'ourselves', 'out', 'over', 'own', 'part', 'per', 'perhaps', 'please', 'put', 'rather', 're', 'same', 'sap', 'see', 'seem', 'seemed', 'seeming', 'seems', 'serious', 'several', 'she', 'should', 'show', 'side', 'since', 'sincere', 'six', 'sixty', 'so', 'some', 'somehow', 'someone', 'something', 'sometime', 'sometimes', 'somewhere', 'still', 'such', 'system', 'take', 'ten', 'than', 'that', 'the', 'their', 'them', 'themselves', 'then', 'thence', 'there', 'thereafter', 'thereby', 'therefore', 'therein', 'thereupon', 'these', 'they', 'thickv', 'thin', 'third', 'this', 'those', 'though', 'three', 'through', 'throughout', 'thru', 'thus', 'to', 'together', 'too', 'top', 'toward', 'towards', 'twelve', 'twenty', 'two', 'un', 'under', 'until', 'up', 'upon', 'us', 'very', 'via', 'was', 'we', 'well', 'were', 'what', 'whatever', 'when', 'whence', 'whenever', 'where', 'whereafter', 'whereas', 'whereby', 'wherein', 'whereupon', 'wherever', 'whether', 'which', 'while', 'whither', 'who', 'whoever', 'whole', 'whom', 'whose', 'why', 'will', 'with', 'within', 'without', 'would', 'yet', 'you', 'your', 'yours', 'yourself', 'yourselves', 'the'];
11+
12+
// no underscores or umlauts or uppercase letters allowed
13+
if (fName.match(/[^a-z0-9-]/)) {
14+
return false;
15+
}
16+
17+
// no filenames with > 50 chars allowed
18+
if (fName.length > 50) {
19+
return false;
20+
}
21+
22+
var chunks = fName.split('-');
23+
24+
// allow only up to 5 unqiue keywords
25+
if(chunks.length > 6) {
26+
return false;
27+
}
28+
29+
// check for common English stop words
30+
for (var i = 0; i < chunks.length; i++) {
31+
if(stopwords.indexOf(chunks[i]) > -1) {
32+
return false;
33+
}
34+
}
35+
36+
return true;
37+
},
38+
error: 'Error: {filename} does not pass the filename conventions'
39+
},
40+
src: [
41+
'**/*.md',
42+
'!node_modules/**/**'
43+
]
44+
},
445
files_check: {
546
images: {
647
options: {
@@ -59,7 +100,8 @@ module.exports = function(grunt) {
59100
grunt.loadNpmTasks('grunt-mdspell');
60101
grunt.loadNpmTasks('grunt-deadlink');
61102
grunt.loadNpmTasks('grunt-files-check');
103+
grunt.loadNpmTasks('grunt-filenames');
62104

63-
grunt.registerTask('test', ['files_check', 'mdspell', 'deadlink']);
105+
grunt.registerTask('test', ['filenames', 'files_check', 'mdspell', 'deadlink']);
64106

65107
};

README.MD

Lines changed: 6 additions & 6 deletions

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"grunt-contrib-clean": "^0.7.0",
2626
"grunt-contrib-copy": "^0.8.2",
2727
"grunt-deadlink": "^0.1.4",
28+
"grunt-filenames": "^0.4.0",
2829
"grunt-files-check": "^0.1.2",
2930
"grunt-mdspell": "^0.4.0"
3031
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)