Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

trailpack-proxy-sitemap

2.1.1 • Public • Published

trailpack-proxy-sitemap

NPM version Build status Dependency Status Code Climate

Sitemap for Proxy Engine. Creates a sitemap.xml available at /sitemap.xml, and rebuilds on a cron schedule.

Install

$ npm install --save trailpack-proxy-sitemap

Configure

// config/main.js
module.exports = {
  packs: [
    // ... other trailpacks
    require('trailpack-proxy-sitemap')
  ]
}
// config/proxySitemap.js
module.exports = {
  host: 'https://<hostname>',
  cache: 1000000
}

Creating a Sitemap

Sitemaps are created in the /api/sitemaps. Create one or many methods that return a Promise and array like the one below. Under the hood, Proxy Sitemap uses Sitemap for more examples on acceptable returns.

The sitemap is broken into methods so that it can deliver multiple sitemaps if necessary and break them up accordingly.

const Sitemap = require('trailpack-proxy-sitemap').Sitemap
 
module.exports = class TestSitemap extends Sitemap {
  test() {
    return Promise.resolve([
      { url: '/page-1/',  changefreq: 'daily', priority: 0.3 },
      { url: '/page-2/',  changefreq: 'monthly',  priority: 0.7 },
      { url: '/page-3/', img: 'http://urlTest.com' }
    ])
  }
}

Install

npm i trailpack-proxy-sitemap

DownloadsWeekly Downloads

1

Version

2.1.1

License

MIT

Last publish

Collaborators

  • avatar