Skip to content

Commit

Permalink
Changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
bglw committed May 3, 2024
1 parent 3e8fc65 commit 4143ca4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 23 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

## Unreleased

* BREAKING: Changed collection configuration format to nest `path` within `inputs`
* Allows multiple inputs to merge into one collection
* Add ability to put each input under a sub key
* Allows fixed metadata to be attacked to each input

## v0.2.1 (May 2, 2024)

* Flatlake now looks into symlinks when finding content
Expand Down
6 changes: 4 additions & 2 deletions docs/content/docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ A simple configuration to start with for the above folder structure is:
```yml
collections:
- output_key: "posts"
path: "collections/posts"
inputs:
- path: "collections/posts"
- output_key: "people"
path: "collections/authors"
inputs:
- path: "collections/authors"
```
This denotes our `posts` and `authors` folders as collections, each output under the same name in our final API.
Expand Down
61 changes: 40 additions & 21 deletions docs/content/docs/collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,60 +15,79 @@ Collections are how files are grouped in Flatlake. Each collection specifies:
`flatlake.yml`:
```yml
collections:
- path: "collections/posts"
output_key: "posts"
- path: "collections/authors"
output_key: "people"
- output_key: "posts"
inputs:
- path: "collections/posts"
- output_key: "people"
inputs:
- path: "collections/authors"
```
## Options
Each collection requires a `path` and an `output_key` to be defined.
Each collection requires an `output_key`, and at least one `inputs` entry containing a `path`.

### Path
### Input > Path

The path from the global `source` to this collection.
A path from the global `source` to add to this collection.

Files within this collection will be treated relative to this path.
Files within this collection input will be treated relative to this path.
In the below example, a file at `<source>/collections/posts/post-a.md` will be output at `<dest>/posts/post-a.json`.

{{< diffcode >}}
```yml
collections:
+ - path: "collections/posts"
output_key: "posts"
- output_key: "posts"
inputs:
+ - path: "collections/posts"
```
{{< /diffcode >}}

### Output key
### Input > Glob

The folder to use when writing single and list files for this collection.
The glob expression Flatlake should use when finding files within this collection. Defaults to `**/*.{md}` to select all markdown files in any directory.

In the below example, a file at `<source>/collections/posts/post-a.md` will be output at `<dest>/files/post-a.json`,
and list files for this collection will be available at `<dest>/files/all/page-1.json`.
{{< diffcode >}}
```yml
collections:
- output_key: "posts"
inputs:
- path: "collections/posts"
+ glob: "**/*.{md}"
```
{{< /diffcode >}}

### Input > Meta

Fixed metadata that should be added to each collection item sourced from this input.

{{< diffcode >}}
```yml
collections:
- path: "collections/posts"
+ output_key: "files"
- output_key: "posts"
inputs:
- path: "collections/posts"
+ meta:
+ source: "collections"
+ url: https://example.com
```
{{< /diffcode >}}

### Glob
### Output key

The glob expression Flatlake should use when finding files within this collection. Defaults to `**/*.{md}` to select all markdown files in any directory.
The folder to use when writing single and list files for this collection.

In the below example, a file at `<source>/collections/posts/post-a.md` will be output at `<dest>/files/post-a.json`,
and list files for this collection will be available at `<dest>/files/all/page-1.json`.

{{< diffcode >}}
```yml
collections:
- path: "collections/posts"
output_key: "posts"
+ glob: "**/*.{md}"
+ output_key: "files"
```
{{< /diffcode >}}


### Page size

The page size to use when writing paginated endpoints within this collection.
Expand Down

0 comments on commit 4143ca4

Please sign in to comment.