Skip to content

Commit b46bf8b

Browse files
authored
docs: nuxt content documentation (#172)
* docs: nuxt content documentation * docs: update static and configuration * docs(fr): add french documentation * fix: nuxt config js prettier * docs: update documentation link on README
1 parent 53a138c commit b46bf8b

26 files changed

+10946
-594
lines changed

README.md

Lines changed: 6 additions & 594 deletions
Large diffs are not rendered by default.

docs/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules
2+
*.iml
3+
.idea
4+
*.log*
5+
.nuxt
6+
.vscode
7+
.DS_Store
8+
coverage
9+
dist
10+
sw.*
11+
.env

docs/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# docs
2+
3+
## Setup
4+
5+
Install dependencies:
6+
7+
```bash
8+
yarn install
9+
```
10+
11+
## Development
12+
13+
```bash
14+
yarn dev
15+
```
16+
17+
## Static Generation
18+
19+
This will create the `dist/` directory for publishing to static hosting:
20+
21+
```bash
22+
yarn generate
23+
```
24+
25+
To preview the static generated app, run `yarn start`
26+
27+
For detailed explanation on how things work, checkout [nuxt/content](https://content.nuxtjs.org) and [@nuxt/content theme docs](https://content.nuxtjs.org/themes-docs).
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: Configuration
3+
description: ''
4+
position: 3
5+
category: Guide
6+
---
7+
8+
Add a custom configuration with the `sitemap` property:
9+
10+
```js[nuxt.config.js]
11+
{
12+
modules: [
13+
'@nuxtjs/sitemap'
14+
],
15+
sitemap: {
16+
// options
17+
},
18+
}
19+
```
20+
21+
The module option parameter can be:
22+
23+
### `Object`
24+
25+
A single item of [sitemap](/usage/sitemap) or [sitemap index](#sitemap-index-options):
26+
27+
```js
28+
{
29+
sitemap: {
30+
// ...
31+
},
32+
}
33+
```
34+
35+
### `Array`
36+
37+
A list of [sitemap](#sitemap-options) or [sitemap index](#sitemap-index-options) items:
38+
39+
```js
40+
{
41+
sitemap: [
42+
{
43+
// ...
44+
},
45+
{
46+
// ...
47+
},
48+
],
49+
}
50+
```
51+
52+
### `Function`
53+
54+
A function that returns a valid sitemap configuration:
55+
56+
```js
57+
{
58+
sitemap: function () {
59+
return {
60+
// ...
61+
}
62+
},
63+
}
64+
```
65+
66+
### `Boolean`
67+
68+
You can disable the sitemap module with a boolean value at `false`:
69+
70+
```js
71+
{
72+
sitemap: false
73+
}
74+
```

docs/content/en/guide/setup.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Setup
3+
description: ''
4+
position: 2
5+
category: Guide
6+
---
7+
8+
## Installation
9+
10+
Add `@nuxtjs/sitemap` dependency to your project:
11+
12+
<code-group>
13+
<code-block label="Yarn" active>
14+
15+
```bash
16+
yarn add @nuxtjs/sitemap
17+
```
18+
19+
</code-block>
20+
<code-block label="NPM">
21+
22+
```bash
23+
npm install @nuxtjs/sitemap
24+
```
25+
26+
</code-block>
27+
</code-group>
28+
29+
## Setup
30+
31+
Add `@nuxtjs/sitemap` to the `modules` section of your `nuxt.config.js` file:
32+
33+
```js[nuxt.config.js]
34+
{
35+
modules: [
36+
'@nuxtjs/sitemap'
37+
],
38+
}
39+
```
40+
41+
> **notice:**
42+
> If you use other modules (eg. `nuxt-i18n`), always declare the sitemap module at end of array
43+
> eg. `modules: ['nuxt-i18n', '@nuxtjs/sitemap']`

docs/content/en/index.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Introduction
3+
description: ''
4+
position: 1
5+
category: ''
6+
features:
7+
- Module based on the awesome sitemap.js package ❤️
8+
- Create sitemap or sitemap index
9+
- Automatically add the static routes to each sitemap
10+
- Support i18n routes from nuxt-i18n (latest version)
11+
- Works with all modes (SSR, SPA, generate)
12+
- For Nuxt 2.x and higher
13+
---
14+
15+
<img src="/preview.png" class="light-img" width="1280" height="640" alt=""/>
16+
<img src="/preview-dark.png" class="dark-img" width="1280" height="640" alt=""/>
17+
18+
[Nuxt Sitemap Module](https://github.com/nuxt-community/sitemap-module) for [NuxtJS](https://nuxtjs.org).
19+
20+
Automatically generate or serve dynamic [sitemap.xml](https://github.com/ekalinin/sitemap.js) for Nuxt projects!
21+
22+
## Features
23+
24+
<list :items="features"></list>
25+
26+
## More Resources
27+
28+
* [GitHub](https://github.com/nuxt-community/sitemap-module)
29+
* [Releases](https://github.com/nuxt-community/sitemap-module/releases)
30+
* [MIT Licence](./LICENSE)
31+
32+
## Contributors
33+
34+
- [Nicolas Pennec](https://github.com/NicoPennec)
35+
- [Pooya Parsa](https://github.com/pi0)

docs/content/en/usage/hooks.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: Hooks
3+
description: ''
4+
position: 7
5+
category: Usage
6+
---
7+
8+
Hooks are listeners to Nuxt events. [Learn more](https://nuxtjs.org/api/configuration-hooks)
9+
10+
You can register hooks on certain life cycle events.
11+
12+
| Hook | Arguments | When |
13+
|---|---|---|
14+
| sitemap:generate:before | (nuxt, sitemapOptions) | Hook on before site generation |
15+
| sitemap:generate:done | (nuxt) | Hook on sitemap generation finished |
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: Sitemap index
3+
description: ''
4+
position: 5
5+
category: Usage
6+
---
7+
8+
### Setup a Sitemap Index
9+
10+
To declare a sitemap index and its linked sitemaps, use the [`sitemaps`](/usage/sitemap-options#sitemaps---array-of-object) property.
11+
12+
By default, the sitemap index is setup to the following path: `/sitemapindex.xml`
13+
14+
Each item of the `sitemaps` array can be setup with its own [sitemap options](/usage/sitemap-options).
15+
16+
```js[nuxt.config.js]
17+
{
18+
sitemap: {
19+
hostname: 'https://example.com',
20+
lastmod: '2017-06-30',
21+
sitemaps: [
22+
{
23+
path: '/sitemap-foo.xml',
24+
routes: ['foo/1', 'foo/2'],
25+
gzip: true
26+
}, {
27+
path: '/folder/sitemap-bar.xml',
28+
routes: ['bar/1', 'bar/2'],
29+
exclude: ['/**']
30+
}
31+
]
32+
}
33+
}
34+
```
35+
36+
### Setup a list of sitemaps
37+
38+
To declare a list of sitemaps, use an `array` to setup each sitemap with its own configuration.
39+
You can combine sitemap and sitemap index configurations.
40+
41+
```js[nuxt.config.js]
42+
{
43+
sitemap: [
44+
{
45+
path: '/sitemap-products.xml',
46+
routes: [
47+
// array of URL
48+
]
49+
}, {
50+
path: '/sitemap-news.xml',
51+
routes: () => // promise or function
52+
}, {
53+
path: '/sitemapindex.xml',
54+
sitemaps: [{
55+
// array of Sitemap configuration
56+
}]
57+
}
58+
}
59+
}
60+
```

0 commit comments

Comments
 (0)