File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 29
29
- [ Sitemap Options] ( #sitemap-options )
30
30
- [ Sitemap Index Options] ( #sitemap-index-options )
31
31
- [ Routes Declaration] ( #routes-declaration )
32
+ - [ Hooks] ( #hooks )
32
33
33
34
## Installation
34
35
@@ -591,6 +592,18 @@ const axios = require('axios')
591
592
}
592
593
```
593
594
595
+
596
+ ## Hooks
597
+
598
+ Hooks are listeners to Nuxt events. [ Learn more] ( https://nuxtjs.org/api/configuration-hooks )
599
+
600
+ You can register hooks on certain life cycle events.
601
+
602
+ | Hook | Arguments | When |
603
+ | ---| ---| ---|
604
+ | sitemap:generate: before | (nuxt, sitemapOptions) | Hook on before site generation |
605
+ | sitemap:generate: done | (nuxt) | Hook on sitemap generation finished |
606
+
594
607
## License
595
608
596
609
[ MIT License] ( ./LICENSE )
Original file line number Diff line number Diff line change @@ -39,8 +39,10 @@ module.exports = async function module(moduleOptions) {
39
39
40
40
// On "generate" mode, generate static files for each sitemap or sitemapindex
41
41
nuxtInstance . nuxt . hook ( 'generate:done' , async ( ) => {
42
+ await nuxtInstance . nuxt . callHook ( 'sitemap:generate:before' , nuxtInstance , options )
42
43
logger . info ( 'Generating sitemaps' )
43
44
await Promise . all ( options . map ( ( options ) => generateSitemaps ( options , globalCache , nuxtInstance ) ) )
45
+ await nuxtInstance . nuxt . callHook ( 'sitemap:generate:done' , nuxtInstance )
44
46
} )
45
47
46
48
// On "ssr" mode, register middlewares for each sitemap or sitemapindex
You can’t perform that action at this time.
0 commit comments