Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow multiple filter values #92

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion content/docs/collection-folder.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The entries for any folder collection can be filtered based on the value of a si
The `filter` option requires two fields:

* `field`: The name of the collection field to filter on.
* `value`: The desired field value.
* `value`: The desired field value or values. This may be a single string, or a list of values.

The example below creates two collections in the same folder, filtered by the `language` field. The first collection includes posts with `language: en`, and the second, with `language: es`.

Expand All @@ -75,6 +75,30 @@ collections:
- {label: "Contenido", name: "body", widget: "markdown"}
```

The example below creates one collection including posts with "en", "en-US" or "en-GB" in the "language" field; and nother with "es", "es-ES" or "es-MX" as the language.

```yaml
collections:
- label: "Blog in English"
name: "english_posts"
folder: "_posts"
create: true
filter: {field: "language", value: ["en", "en-US", "en-GB"]}
fields:
- {label: "Language", name: "language", widget: "select", options: ["en", "es"]}
- {label: "Title", name: "title", widget: "string"}
- {label: "Content", name: "body", widget: "markdown"}
- label: "Blog en Español"
name: "spanish_posts"
folder: "_posts"
create: true
filter: {field: "language", value: ["es", "es-ES", "es-MX"]}
fields:
- {label: "Lenguaje", name: "language", widget: "select", options: ["en", "es"]}
- {label: "Titulo", name: "title", widget: "string"}
- {label: "Contenido", name: "body", widget: "markdown"}
```


### Folder Collections Path

Expand Down