Skip to content

Commit

Permalink
chore(index): Update ref id's for docs indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Bradley committed Mar 26, 2014
1 parent 8ec7c00 commit db74296
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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('---');
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit db74296

Please sign in to comment.