1.8.0-beta.7 • Published 2 years ago

@elderjs/plugin-sitemap v1.8.0-beta.7

Weekly downloads
49
License
MIT
Repository
github
Last release
2 years ago

Elder.js Plugin: Sitemap

Easily generate a sitemap for your Elder.js website.

By default it will build a sitemap when you build your Elder.js site.

This sitemap will include a sub-sitemap for each route.

Currently there is a hard limit of 50,000 urls per sub-sitemap.

Install

npm install --save @elderjs/plugin-sitemap

Config

Once installed, open your elder.config.js and configure the plugin by adding @elderjs/plugin-sitemap to your plugin object.

plugins: {

  '@elderjs/plugin-sitemap': {
    origin: '', // the https://yourdomain.com
    exclude: [], // an array of permalinks or permalink prefixes. So you can do ['500'] and it will match /500**
    routeDetails: {}, // set custom priority and change freq if not it falls back to default
    lastUpdate: {}, // configurable last update for each route type.
  },

}

Configuring Route Specific Details

plugins: {
  '@elderjs/plugin-sitemap': {
    origin: '', // the https://yourdomain.com
    exclude: [], // an array of permalinks or permalink prefixes. So you can do ['500'] and it will match /500**
    routeDetails: {
      home: {
        priority: 1.0,
        changefreq: 'monthly',
      },
      blog: {
        priority: 0.8,
        changfreq: 'monthly',
      }
    }, // set custom priority and change freq if not it falls back to default
    lastUpdate: { // configurable last update for each route type.
      home: '2020-01-01',
      blog: async ({ query, request }) => {
        // receives the query prop from hooks. This allows you to hit your db or api or anything else configured on your query object.
        // return a date object.
        return new Date(Date.now());
      }
    }, 
  },
}

Exclusion Logic is Greedy

For example excluding 'green' route

exclude: ['green'],

would excude all routes starting with 'green', also 'greenland' and 'green-eggs'

'green' route could be explicitly excluded with

exclude: ['green/'],

Also nested routes or specific slugs of route could be excluded with

exclude: ['green/', 'greenland/polar-bear'],
1.8.0-beta.7

2 years ago

1.8.0-beta.6

2 years ago

1.8.0-beta.5

2 years ago

1.8.0-beta.4

2 years ago

1.3.10

2 years ago

1.3.9

2 years ago

1.3.8

2 years ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.2.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.41

3 years ago

0.1.42

3 years ago

0.1.43

3 years ago

0.1.44

3 years ago

0.1.40

3 years ago

0.1.39

3 years ago

0.1.38

3 years ago

0.1.30

3 years ago

0.1.31

3 years ago

0.1.34

3 years ago

0.1.35

3 years ago

0.1.36

3 years ago

0.1.37

3 years ago

0.1.27

3 years ago

0.1.28

3 years ago

0.1.29

3 years ago

0.1.22

3 years ago

0.1.26

3 years ago

0.1.21

3 years ago

0.1.20

3 years ago

0.1.19

3 years ago

0.1.18

3 years ago

0.1.17

4 years ago

0.1.15

4 years ago

0.1.16

4 years ago

0.1.14

4 years ago

0.1.12

4 years ago

0.1.13

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.5

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.1.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago