Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pgilad committed Jun 21, 2014
1 parent 2504b5d commit 870d1c6
Showing 1 changed file with 45 additions and 37 deletions.
82 changes: 45 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![NPM version](http://img.shields.io/npm/v/gulp-sitemap.svg?style=flat)](https://www.npmjs.org/package/gulp-sitemap)
[![NPM Downloads](http://img.shields.io/npm/dm/gulp-sitemap.svg?style=flat)](https://www.npmjs.org/package/gulp-sitemap)
[![Dependencies](http://img.shields.io/gemnasium/pgilad/gulp-sitemap.svg?style=flat)](https://gemnasium.com/pgilad/gulp-sitemap)
[![Build Status](http://img.shields.io/travis/pgilad/gulp-sitemap/master.svg?style=flat)](https://travis-ci.org/pgilad/gulp-sitemap)

Easily generate a search engine friendly sitemap.xml from your project.
Expand All @@ -15,9 +14,6 @@ Easily generate a search engine friendly sitemap.xml from your project.
Install with [npm](https://npmjs.org/package/gulp-sitemap)

```bash
$ npm i -D gulp-sitemap

#or use the long and tiring version:
$ npm install --save-dev gulp-sitemap
```

Expand All @@ -32,35 +28,15 @@ gulp.task('sitemap', function () {
read: false
}).pipe(sitemap({
siteUrl: 'http://www.amazon.com'
}))
.pipe(gulp.dest('build/'));
}))
.pipe(gulp.dest('build/'));
});
```

* File content isn't necessary when reading files - so to speed up building - use `{read:false}` on `gulp.src`.
* File content isn't necessary when reading files. To speed up building use `{read:false}` with `gulp.src`.
* *index.html* will be turned into directory path `/`.
* *404.html* will be skipped automatically. No need to unglob it.

## Example with all options and their defaults
```js
var gulp = require('gulp');
var sitemap = require('gulp-sitemap');

gulp.task('sitemap', function () {
gulp.src('build/**/*.html', {
read: false
}).pipe(sitemap({
fileName: 'sitemap.xml',
newLine: '\n',
changeFreq: 'daily',
priority: '0.5',
siteUrl: 'http://www.amazon.com',
spacing: ' '
}))
.pipe(gulp.dest('build/'));
});
```

## Options

### siteUrl
Expand All @@ -69,38 +45,70 @@ gulp.task('sitemap', function () {

Your website's base url. This gets prepended to all documents locations.

### fileName
Type: `String`

Default: `sitemap.xml`
### fileName

Determine the output filename for the sitemap.

Type: `String`

### changeFreq
Default: `sitemap.xml`

Default: `daily`
### changeFreq

Gets filled inside the sitemap in the tag `<changefreq>`.

### priority
Type: `String`

Default: `0.5`
Default: `daily`

### priority

Gets filled inside the sitemap in the tag `<priority>`.

### newLine
Type: `String`

Default: Your OS's new line, mostly: `\n`
Default: `0.5`

### newLine

How to join line in the target sitemap file.

### spacing
Type: `String`

Default: ' '
Default: Your OS's new line, mostly: `\n`

### spacing

How should the sitemap xml file be spaced. You can use `\t` for tabs, or ` ` with 2
spaces if you'd like.

Type: `String`

Default: ' '

## Example usage with all default options

```js
var gulp = require('gulp');
var sitemap = require('gulp-sitemap');

gulp.task('sitemap', function () {
gulp.src('build/**/*.html', {
read: false
}).pipe(sitemap({
fileName: 'sitemap.xml',
newLine: '\n',
changeFreq: 'daily',
priority: '0.5',
siteUrl: '', // no default - this is a required param
spacing: ' '
}))
.pipe(gulp.dest('build/'));
});
```

## Thanks

To [grunt-sitemap](https://github.com/RayViljoen/grunt-sitemap) for the inspiration on writing this.
Expand Down

0 comments on commit 870d1c6

Please sign in to comment.