1
0
mirror of https://github.com/dzeiocom/libs.git synced 2025-04-23 03:12:12 +00:00
libs/packages/easy-sitemap
Florian Bouillon 799c0269c2 Publish
- @dzeio/dom-manager@1.2.4
 - easy-sitemap@1.0.1
 - @dzeio/listener@1.0.1
 - @dzeio/logger@2.0.3
 - @dzeio/object-util@1.0.5
 - @dzeio/queue@1.1.3
 - @dzeio/url-manager@1.0.5
2021-02-08 11:26:49 +01:00
..
2021-01-20 12:30:32 +01:00
2021-01-20 12:30:32 +01:00
2021-01-20 12:30:32 +01:00
2021-01-20 12:30:32 +01:00
2021-01-20 12:30:32 +01:00
2021-01-20 12:30:32 +01:00
2021-02-08 11:26:49 +01:00
2021-01-20 12:30:32 +01:00
2021-01-20 12:30:32 +01:00

URL Manager

A very easy to use sitemap generator

Usage

  • Import easy-sitemap
import Sitemap from 'easy-sitemap'
// or
const Sitemap = require('easy-sitemap').default
  • Initialize it
// Create a new instance
const sitemap = new Sitemap('https://www.example.com') // initialize using your website base

// if you want to let the library manage the response object the line is this
const sitemap = new Sitemap('https://www.example.com', {
	response: res
})

  • add you're paths
sitemap.addEntry('/path')

// you can also add optionnal elements
sitemap.addEntry('/path', {
	// each one are optionnal and they don't all need to be added
	changefreq: 'always', // webpage change freq
	lastmod: new Date('2021-01-20'), // webpage lastmod Date
	priority: 1 // crawler priority
})
  • finally build it !
// it will return a string containing the whole sitemap
// if you are letting the library manage the response Object it will return an empty string but the page will render ! 
const result = sitemap.build()