Skip to content

Commit

Permalink
Use sm consistently in Sitemap API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
accidentaldeveloper authored Sep 12, 2019
1 parent aae23bc commit 8157691
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ const smi = createSitemapIndex({

```
const { Sitemap } = require('sitemap')
const smi = new Sitemap({
const sm = new Sitemap({
urls: [{url: '/path'}],
hostname: 'http://example.com',
cacheTime: 0, // default
Expand All @@ -236,7 +236,7 @@ sm.toString() // returns the xml as a string

__toString__
```
smi.toString(true)
sm.toString(true)
```
Converts the urls stored in an instance of Sitemap to a valid sitemap xml document as a string. Accepts a boolean as its first argument to designate on whether to pretty print. Defaults to false.

Expand All @@ -245,47 +245,47 @@ alias for toString

__toGzip__
```
smi.toGzip ((xmlGzippedBuffer) => console.log(xmlGzippedBuffer));
smi.toGzip();
sm.toGzip ((xmlGzippedBuffer) => console.log(xmlGzippedBuffer));
sm.toGzip();
```
like toString, it builds the xmlDocument, then it runs gzip on the resulting string and returns it as a Buffer via callback or direct invokation

__clearCache__
```
smi.clearCache()
sm.clearCache()
```
cache will be emptied and will be bipassed until set again

__isCacheValid__
```
smi.isCacheValid()
sm.isCacheValid()
```
returns true if it has been less than cacheTimeout ms since cache was set

__setCache__
```
smi.setCache('...xmlDoc')
sm.setCache('...xmlDoc')
```
stores the passed in string on the instance to be used when toString is called within the configured cacheTimeout
returns the passed in string unaltered

__add__
```
smi.add('/path', 'warn')
sm.add('/path', 'warn')
```
adds the provided url to the sitemap instance
takes an optional parameter level for whether to print a console warning in the event of bad data 'warn' (default), throw an exception 'throw', or quietly ignore bad data 'silent'
returns the number of locations currently in the sitemap instance

__contains__
```
smi.contains('/path')
sm.contains('/path')
```
Returns true if path is already a part of the sitemap instance, false otherwise.

__del__
```
smi.del('/path')
sm.del('/path')
```
removes the provided url or url option from the sitemap instance

Expand Down

0 comments on commit 8157691

Please sign in to comment.