-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathgulpfile.js
66 lines (62 loc) · 1.65 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
'use strict';
var gulp = require('gulp');
var sitemap = require('./index');
var execSync = require('child_process').execSync;
gulp.task('default', function () {
gulp.src('test/fixtures/**/*.html', {
read: false
})
.pipe(sitemap({
siteUrl: 'http://www.amazon.com/',
priority: '0.5',
changefreq: 'weekly'
}))
.pipe(gulp.dest('./'));
});
gulp.task('hreflang', function () {
gulp.src('test/fixtures/**/*.html', {
read: false
})
.pipe(sitemap({
siteUrl: 'http://www.amazon.com/',
priority: '0.5',
changefreq: 'weekly',
hreflang: [{
lang: 'ru',
getHref: function(siteUrl, file, lang, loc) {
// return href src for the hreflang. For example:
return 'http://www.amazon.ru/' + file;
}
}]
}))
.pipe(gulp.dest('./'));
});
gulp.task('git', function () {
gulp.src('test/fixtures/**/*.html', {
read: false
})
.pipe(sitemap({
siteUrl: 'http://www.amazon.com/',
priority: '0.5',
changefreq: 'weekly',
lastmod: function (file) {
var cmd = 'git log -1 --format=%cI "' + file.relative + '"';
return execSync(cmd, {
cwd: file.base
}).toString().trim();
}
}))
.pipe(gulp.dest('./'));
});
gulp.task('remove-file-extension', function () {
gulp.src('test/fixtures/**/*.html', {
read: false
})
.pipe(sitemap({
siteUrl: 'https://vanceauto.com',
getLoc(siteUrl, loc) {
return loc.replace(/\.\w+$/, '');
},
}))
.pipe(gulp.dest('./'));
});