Skip to content

Commit

Permalink
docs: pre-render pages (#2196)
Browse files Browse the repository at this point in the history

Co-authored-by: nobkd <44443899+nobkd@users.noreply.github.com>
  • Loading branch information
farnabaz and nobkd committed Jul 26, 2023
1 parent beaa64f commit 3e62155
Show file tree
Hide file tree
Showing 28 changed files with 133 additions and 116 deletions.
20 changes: 10 additions & 10 deletions docs/content-v1/en/1.getting-started/3.writing.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The `createdAt` and `updatedAt` properties are based on the file's actual create

This module converts your `.md` files into a JSON AST tree structure, stored in a `body` variable.

Make sure to use the `<nuxt-content>` component to display the `body` of your markdown content, see [displaying content](/displaying).
Make sure to use the `<nuxt-content>` component to display the `body` of your markdown content, see [displaying content](/v1/getting-started/displaying).

> You can check the [basic syntax guide](https://www.markdownguide.org/basic-syntax) to help you master Markdown
Expand Down Expand Up @@ -133,7 +133,7 @@ It will be transformed to its JSON AST structure, and by using the `nuxt-content
### Links

Links are transformed to add valid `target` and `rel` attributes using [remark-external-links](https://github.com/remarkjs/remark-external-links). You can check [here](/configuration#markdown) to learn how to configure this plugin.
Links are transformed to add valid `target` and `rel` attributes using [remark-external-links](https://github.com/remarkjs/remark-external-links). You can check [here](/v1/getting-started/configuration#markdown) to learn how to configure this plugin.

Relative links are also automatically transformed to [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/) to provide navigation between page components with enhanced performance through smart prefetching.

Expand All @@ -159,7 +159,7 @@ title: Home

### Footnotes

This module supports extended markdown syntax for footnotes using [remark-footnotes](https://github.com/remarkjs/remark-footnotes). You can check [here](/configuration#markdown) to learn how to configure this plugin.
This module supports extended markdown syntax for footnotes using [remark-footnotes](https://github.com/remarkjs/remark-footnotes). You can check [here](/v1/getting-started/configuration#markdown) to learn how to configure this plugin.

Here is an example using footnotes:

Expand All @@ -181,7 +181,7 @@ Here's a simple footnote,[^1] and here's a longer one.[^bignote]
### Codeblocks

This module automatically wraps codeblocks and applies [PrismJS](https://prismjs.com) classes (see [syntax highlighting](/writing#syntax-highlighting)).
This module automatically wraps codeblocks and applies [PrismJS](https://prismjs.com) classes (see [syntax highlighting](/v1/getting-started/writing#syntax-highlighting)).

Codeblocks in Markdown are wrapped inside 3 backticks. Optionally, you can define the language of the codeblock to enable specific syntax highlighting.

Expand Down Expand Up @@ -226,7 +226,7 @@ Filename will be converted to a span with a `filename` class. It's up to you to
### Syntax highlighting

It supports by default code highlighting using [PrismJS](https://prismjs.com) and injects the theme defined in options into your Nuxt.js app, see [configuration](/configuration#markdownprismtheme).
It supports by default code highlighting using [PrismJS](https://prismjs.com) and injects the theme defined in options into your Nuxt.js app, see [configuration](/v1/getting-started/configuration#markdownprismtheme).

### HTML

Expand Down Expand Up @@ -274,7 +274,7 @@ You can use global Vue components or locally registered in the page you're displ

<alert type="warning">

An issue exists with locally registered components and live edit in development, since **v1.5.0** you can disable it by setting `liveEdit: false` (see [configuration](/configuration#liveedit)).
An issue exists with locally registered components and live edit in development, since **v1.5.0** you can disable it by setting `liveEdit: false` (see [configuration](/v1/getting-started/configuration#liveedit)).

</alert>

Expand Down Expand Up @@ -338,7 +338,7 @@ multiselectOptions:

<alert type="info">

These components will be rendered using the `<nuxt-content>` component, see [displaying content](/displaying#component).
These components will be rendered using the `<nuxt-content>` component, see [displaying content](/v1/getting-started/displaying#component).

</alert>

Expand Down Expand Up @@ -399,7 +399,7 @@ When fetching a document, we have access to a toc property which is an array of
<alert type="info">

Check out [this snippet](/snippets#table-of-contents) on how to implement a table of contents into your app
Check out [this snippet](/v1/community/snippets#table-of-contents) on how to implement a table of contents into your app

</alert>

Expand Down Expand Up @@ -474,7 +474,7 @@ Will be transformed into:
}
```

We internally add a `text` key with the markdown body that will be used for [searching](/fetching#searchfield-value) or [extending](/advanced#contentfilebeforeinsert) it.
We internally add a `text` key with the markdown body that will be used for [searching](/v1/getting-started/fetching#searchfield-value) or [extending](/v1/getting-started/advanced#contentfilebeforeinsert) it.

## JSON / JSON5

Expand All @@ -486,7 +486,7 @@ Data defined will be injected into the document.

<badge>v0.10.0+</badge>

You can now use arrays inside your `.json` files. Objects will be flattened and inserted into the collection. You can [fetch](/fetching) your content in the same way as your used to.
You can now use arrays inside your `.json` files. Objects will be flattened and inserted into the collection. You can [fetch](/v1/getting-started/fetching) your content in the same way as your used to.

<alert type="warning">

Expand Down
12 changes: 6 additions & 6 deletions docs/content-v1/en/1.getting-started/4.fetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const articles = await this.$content('articles').where({ age: { $gt: 18 } }).fet
const articles = await this.$content('articles').where({ name: { $in: ['odin', 'thor'] } }).fetch()
```

In order to filter in objects and array you need to enable nestedProperties, see [configuration](/configuration#nestedproperties).
In order to filter in objects and array you need to enable nestedProperties, see [configuration](/v1/getting-started/configuration#nestedproperties).

```js
const products = await this.$content('products').where({ 'categories.slug': { $contains: 'top' } }).fetch()
Expand Down Expand Up @@ -112,7 +112,7 @@ const articles = await this.$content('articles').sortBy('title').fetch()

`sortBy` method does **case-sensitive** sort, which is currently not configurable.

If you need case-insensitive sorting, check out [this snippet](/snippets#case-insensitive-sorting) on how to work around it.
If you need case-insensitive sorting, check out [this snippet](/v1/community/snippets#case-insensitive-sorting) on how to work around it.

</alert>

Expand Down Expand Up @@ -152,7 +152,7 @@ const articles = await this.$content('articles').skip(5).limit(5).fetch()

Performs a full-text search on a field. `value` is optional, in this case `field` is the `value` and search will be performed on all defined full-text search fields.

The fields you want to search on must be defined in options in order to be indexed, see [configuration](/configuration#fulltextsearchfields).
The fields you want to search on must be defined in options in order to be indexed, see [configuration](/v1/getting-started/configuration#fulltextsearchfields).

Using an empty string as parameter will skip the search.

Expand All @@ -167,7 +167,7 @@ const articles = await this.$content('articles').search('').fetch()

<alert type="info">

Check out [this snippet](/snippets#search) on how to implement search into your app
Check out [this snippet](/v1/community/snippets#search) on how to implement search into your app

</alert>

Expand Down Expand Up @@ -212,7 +212,7 @@ Getting results based on `path` is only supported since v1.12.0

<alert type="info">

Check out [this snippet](/snippets#prev-and-next) on how to implement prev and next links into your app
Check out [this snippet](/v1/community/snippets#prev-and-next) on how to implement prev and next links into your app

</alert>

Expand Down Expand Up @@ -249,4 +249,4 @@ const articles = await this.$content('articles')
})
```

> You can check how to use the [Content API](/advanced#api-endpoint) in development.
> You can check how to use the [Content API](/v1/getting-started/advanced#api-endpoint) in development.
4 changes: 2 additions & 2 deletions docs/content-v1/en/1.getting-started/5.displaying.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ export default {
- tag:
- Type: `string`

Learn more about what you can write in your markdown file in the [writing content](/writing#markdown) section.
Learn more about what you can write in your markdown file in the [writing content](/v1/getting-started/writing#markdown) section.

### Excerpt

If you are utilizing the [excerpt](/writing#excerpt) feature, you can display the content of your excerpt using the following model:
If you are utilizing the [excerpt](/v1/getting-started/writing#excerpt) feature, you can display the content of your excerpt using the following model:

```vue
<template>
Expand Down
4 changes: 2 additions & 2 deletions docs/content-v1/en/1.getting-started/6.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ content: {
- Type: `Array`
- Default: `['title', 'description', 'slug', 'text']`

Fields that needs to be indexed to be searchable, learn more about search [here](/fetching#searchfield-value).
Fields that needs to be indexed to be searchable, learn more about search [here](/v1/getting-started/fetching#searchfield-value).

`text` is a special key that contains your Markdown before being parsed to AST.

Expand Down Expand Up @@ -431,7 +431,7 @@ export default {
}
```

> You can head over to [Snippets - Custom Highlighter](/snippets#custom-highlighter) section to see more example.
> You can head over to [Snippets - Custom Highlighter](/v1/community/snippets#custom-highlighter) section to see more example.
### `yaml`

Expand Down
8 changes: 4 additions & 4 deletions docs/content-v1/en/1.getting-started/7.advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Arguments:
- `document`
- Type: `object`
- Properties:
- See [writing content](/writing)
- See [writing content](/v1/getting-started/writing)
- `database`
- Type: `object`
- Properties:
Expand Down Expand Up @@ -157,7 +157,7 @@ Arguments:
- `options`
- Type: `object`
- Properties:
- See [configuration](/configuration#properties)
- See [configuration](/v1/getting-started/configuration#properties)

**Example**

Expand Down Expand Up @@ -213,7 +213,7 @@ This documentation uses it actually. You can learn more by looking at [plugins/i

## API Endpoint

This module exposes an API endpoint in development so you can easily see the JSON of each directory or file, it is available on [http://localhost:3000/_content/](http://localhost:3000/_content/). The prefix is `_content` by default and can be configured with the [apiPrefix](/configuration#apiprefix) property.
This module exposes an API endpoint in development so you can easily see the JSON of each directory or file, it is available on [http://localhost:3000/_content/](http://localhost:3000/_content/). The prefix is `_content` by default and can be configured with the [apiPrefix](/v1/getting-started/configuration#apiprefix) property.

**Example**

Expand Down Expand Up @@ -246,7 +246,7 @@ Since **v1.4.0**, this endpoint also supports `where` in query params:

> This module uses LokiJS under the hood. You can check here for [query examples](https://github.com/techfort/LokiJS/wiki/Query-Examples#find-queries).
- You can use [nested properties](/configuration#nestedproperties):
- You can use [nested properties](/v1/getting-started/configuration#nestedproperties):

`http://localhost:3000/_content/products?categories.slug_contains=top`

Expand Down
8 changes: 4 additions & 4 deletions docs/content-v1/en/3.community/1.snippets.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default {
</script>
```

> Check out the [search documentation](/fetching#searchfield-value)
> Check out the [search documentation](/v1/getting-started/fetching#searchfield-value)
### Prev and Next

Expand Down Expand Up @@ -145,7 +145,7 @@ even when the current page is showing the higer-positioned document.

</alert>

> Check out the [surround documentation](/fetching#surroundslugorpath-options)
> Check out the [surround documentation](/v1/getting-started/fetching#surroundslugorpath-options)
### Case-Insensitive Sorting

Expand Down Expand Up @@ -185,7 +185,7 @@ export default {
}
```

> Check out the [`sortBy` documentation](/fetching#sortbykey-direction)
> Check out the [`sortBy` documentation](/v1/getting-started/fetching#sortbykey-direction)
### Table of contents

Expand Down Expand Up @@ -218,7 +218,7 @@ export default {
</script>
```

> Check out the [Table of contents documentation](/writing#table-of-contents)
> Check out the [Table of contents documentation](/v1/getting-started/writing#table-of-contents)
### Dynamic routing

Expand Down
14 changes: 7 additions & 7 deletions docs/content-v1/fr/1.getting-started/3.writing.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Ce module analysera les fichiers `.md`, `.yaml`, `.csv`, `.json`, `.json5` et g

Ce module convertit vos fichiers `.md` en une arborescence JSON AST, stockée dans une variable `body`.

Assurez-vous d'utiliser le composant `<nuxt-content>` afin d'afficher le `body` de votre contenu Markdown, voir [afficher du contenu](/fr/displaying).
Assurez-vous d'utiliser le composant `<nuxt-content>` afin d'afficher le `body` de votre contenu Markdown, voir [afficher du contenu](/fr/v1/getting-started/displaying).

> Vous pouvez consulter le [guide syntaxique de base](https://www.markdownguide.org/basic-syntax) pour apprendre à maîtriser le Markdown.
Expand Down Expand Up @@ -127,7 +127,7 @@ Il sera transformé en une structure JSON AST, et en utilisant le composant `nux
### Liens

Les liens sont transformés afin d'y ajouter des attributs `target` et `rel` valides. Vous pouvez modifier ce comportement, voir [configuration](/fr/configuration#markdownexternallinks). Les liens relatifs sont eux aussi transformés automatiquement en `nuxt-link` afin d'apporter une navigation entre pages plus performante à l'aide du smart prefetching.
Les liens sont transformés afin d'y ajouter des attributs `target` et `rel` valides. Vous pouvez modifier ce comportement, voir [configuration](/fr/v1/getting-started/configuration#markdownexternallinks). Les liens relatifs sont eux aussi transformés automatiquement en `nuxt-link` afin d'apporter une navigation entre pages plus performante à l'aide du smart prefetching.

Voici un exemple illustrant l'utilisation de liens externes et relatifs, en utilisant les syntaxes Markdown et HTML:

Expand Down Expand Up @@ -173,7 +173,7 @@ Voici une note de bas de page basique,[^1] et en voici une longue.[^bignote]
### Blocs de code

Ce module enveloppe automatiquement les blocs de code et leur applique des classes propres à [PrismJS](https://prismjs.com) (voir [coloration syntaxique](/fr/writing#syntax-highlighting)).
Ce module enveloppe automatiquement les blocs de code et leur applique des classes propres à [PrismJS](https://prismjs.com) (voir [coloration syntaxique](/fr/v1/getting-started/writing#syntax-highlighting)).

Dans du Markdown, les blocs de code sont entourés de 3 backticks. Vous pouvez éventuellement définir le langage du bloc de code pour activer la coloration syntaxique associée.

Expand Down Expand Up @@ -212,7 +212,7 @@ Voici le résultat après que le composant `nuxt-content` ait généré le rendu
### Coloration syntaxique

La coloration syntaxique est prise en charge par défaut grâce à [PrismJS](https://prismjs.com), en injectant le thème défini dans les options de votre application Nuxt.js, voir [configuration](/fr/configuration#markdownprismtheme).
La coloration syntaxique est prise en charge par défaut grâce à [PrismJS](https://prismjs.com), en injectant le thème défini dans les options de votre application Nuxt.js, voir [configuration](/fr/v1/getting-started/configuration#markdownprismtheme).

### HTML

Expand Down Expand Up @@ -318,7 +318,7 @@ multiselectOptions:

<alert type="info">

Ces composants seront rendus en utilisant le composant `<nuxt-content>`, voir [afficher du contenu](/fr/displaying#component).
Ces composants seront rendus en utilisant le composant `<nuxt-content>`, voir [afficher du contenu](/fr/v1/getting-started/displaying#component).

</alert>

Expand Down Expand Up @@ -401,9 +401,9 @@ Sera transformé en:
}
```

En interne, nous associons une clé `text` avec le corps du Markdown afin de pouvoir l'utiliser pour la [recherche](/fr/fetching#searchfield-value) ou pour créer des [hooks](/fr/advanced#contentfilebeforeinsert).
En interne, nous associons une clé `text` avec le corps du Markdown afin de pouvoir l'utiliser pour la [recherche](/fr/v1/getting-started/fetching#searchfield-value) ou pour créer des [hooks](/fr/v1/getting-started/advanced#contentfilebeforeinsert).

Vous pouvez découvrir la façon d'afficher du Markdown au sein de vos applications dans la section [afficher du contenu](/fr/displaying).
Vous pouvez découvrir la façon d'afficher du Markdown au sein de vos applications dans la section [afficher du contenu](/fr/v1/getting-started/displaying).

## CSV

Expand Down
6 changes: 3 additions & 3 deletions docs/content-v1/fr/1.getting-started/4.fetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const articles = await this.$content('articles').where({ age: { $gt: 18 } }).fet
const articles = await this.$content('articles').where({ name: { $in: ['odin', 'thor'] } }).fetch()
```

Pour filtrer des objets et des tableaux, vous devez configurer la propritété `nestedProperties`, voir la partie [configuration](/fr/configuration#nestedproperties).
Pour filtrer des objets et des tableaux, vous devez configurer la propritété `nestedProperties`, voir la partie [configuration](/fr/v1/getting-started/configuration#nestedproperties).

```js
const produits = await this.$content('produits').where({ 'categories.slug': { $contains: 'haut' } }).fetch()
Expand Down Expand Up @@ -137,7 +137,7 @@ const articles = await this.$content('articles').skip(5).limit(5).fetch()

Effectue une recherche plein texte sur un champ. Le paramètre `value` est optionnel, dans ce cas `field` devient la `value`  et la recherche est alors effectuée sur tous les champs définis en tant que champ de recherche plein texte.

Le champ sur lequel vous voulez effectuer la recherche doit être défini dans les options afin d'être indexé, voir [configuration](/fr/configuration#fulltextsearchfields).
Le champ sur lequel vous voulez effectuer la recherche doit être défini dans les options afin d'être indexé, voir [configuration](/fr/v1/getting-started/configuration#fulltextsearchfields).

Utiliser une chaîne de caractères vide comme paramètre `value` n'exécutera pas la recherche.

Expand Down Expand Up @@ -209,7 +209,7 @@ const articles = await this.$content('articles')

## API

Lorsque vous développez, ce module expose une API qui vous permet facilement de consulter les données de chaque répertoire ou fichier au format JSON, à l'adresse http://localhost:3000/_content/. Par défaut, le préfixe est `_content` mais il peut être configuré à l'aide la la propriété [apiPrefix](/fr/configuration#apiprefix).
Lorsque vous développez, ce module expose une API qui vous permet facilement de consulter les données de chaque répertoire ou fichier au format JSON, à l'adresse http://localhost:3000/_content/. Par défaut, le préfixe est `_content` mais il peut être configuré à l'aide la la propriété [apiPrefix](/fr/v1/getting-started/configuration#apiprefix).

Exemple:

Expand Down
2 changes: 1 addition & 1 deletion docs/content-v1/fr/1.getting-started/5.displaying.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
- Type: `object`
- `requis`

Vous pouvez en apprendre davantage au sujet de ce que vous pouvez écrire dans vos fichiers Markdown dans la section [écrire du contenu](/fr/writing#markdown).
Vous pouvez en apprendre davantage au sujet de ce que vous pouvez écrire dans vos fichiers Markdown dans la section [écrire du contenu](/fr/v1/getting-started/writing#markdown).

## Style

Expand Down
2 changes: 1 addition & 1 deletion docs/content-v1/fr/1.getting-started/6.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ content: {
- Type: `Array`
- Défaut: `['title', 'description', 'slug', 'text']`

Les champs qui ont besoin d'être indexés afin d'être recherchables, vous pouvez en apprendre plus sur les recherches [ici](/fr/fetching#searchfield-value).
Les champs qui ont besoin d'être indexés afin d'être recherchables, vous pouvez en apprendre plus sur les recherches [ici](/fr/v1/getting-started/fetching#searchfield-value).

`text` est une propriété spéciale qui contient votre Markdown avant qu'il soit converti en AST.

Expand Down
2 changes: 1 addition & 1 deletion docs/content-v1/fr/1.getting-started/7.advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Arguments:
- `document`
- Type: `object`
- Propriétés:
- Voir [écrire du contenu](/fr/writing)
- Voir [écrire du contenu](/fr/v1/getting-started/writing)

**Exemple**

Expand Down

0 comments on commit 3e62155

Please sign in to comment.