chore(index): Update ref id's for docs indexing

This commit is contained in:
Adam Bradley
2014-03-26 15:34:48 -05:00
parent 8ec7c00f59
commit db74296e23

View File

@@ -52,12 +52,13 @@ gulp.task('docs-index', function() {
this.field('path');
this.field('title', {boost: 10});
this.field('body');
this.ref('path');
this.ref('id');
});
var ref = {};
var refId = 0;
return gulp.src([
'tmp/ionic-site/docs/{components,guide,overview,api}/**/*.{md,html}',
'tmp/ionic-site/docs/{components,guide,api}/**/*.{md,html}',
'tmp/ionic-site/tutorials/**/*.{md,html}'
])
.pipe(es.map(function(file, callback) {
@@ -66,6 +67,11 @@ gulp.task('docs-index', function() {
// Grab relative path from ionic-site root
var relpath = file.path.replace(/^.*?tmp\/ionic-site\//, '');
var path = '/' + relpath.replace('index.md', '')
.replace('index.html', '')
.replace('.md', '.html')
.replace('.markdown', '.html');
// Read out the yaml portion of the Jekyll file
var title, layout;
var yamlStartIndex = contents.indexOf('---');
@@ -99,8 +105,9 @@ gulp.task('docs-index', function() {
parser.end();
// Add the data to the indexer and ref object
idx.add({'path': relpath, 'body': body, 'title': title});
ref[relpath] = {'title': title, 'layout': layout};
idx.add({'path': path, 'body': body, 'title': title, id: refId});
ref[refId] = {'p': path, 't': title, 'l': layout};
refId++;
callback();
})).on('end', function() {