From 870d1c61dc49330365749d2d3fc6f4981b09f6b2 Mon Sep 17 00:00:00 2001 From: Gilad Peleg Date: Sun, 22 Jun 2014 01:08:38 +0300 Subject: [PATCH] Update readme --- README.md | 82 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index ad5e8a2..06073eb 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 ``` @@ -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 @@ -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 ``. -### priority +Type: `String` -Default: `0.5` +Default: `daily` + +### priority Gets filled inside the sitemap in the tag ``. -### 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.