Skip to content

Commit dce0c77

Browse files
authored
Merge pull request #97 from skierpage/patch-data-link
docs: Improve data explanation, more links
2 parents 0e480e9 + f4f7a17 commit dce0c77

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

docs/data.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ data:
66
---
77
## Data Files
88

9-
Cobalt supports loading [yaml](http://yaml.org), [json](http://json.org), and
10-
[toml](https://github.com/toml-lang/toml.html) from [`_data`](/docs/directory)
11-
and making it available as [`site.data.<DIR>.<FILE>`](/docs/variables).
9+
Cobalt reads data from any [yaml](http://yaml.org), [json](http://json.org), and
10+
[toml](https://github.com/toml-lang/toml.html) files in the [`_data` directory](/docs/directory)
11+
and merges them into the [`site.data`](/docs/variables) variable, making
12+
them available as `site.data.<DIR>.<FILE>`.
1213

1314
### Example
1415

@@ -17,7 +18,7 @@ In `_data/animals/dogs.yml`:
1718
- name: Corgi
1819
- name: Malamute
1920
```
20-
which can be accessed via `site.data.animals.dogs`.
21+
which liquid templates can access via `site.data.animals.dogs`.
2122

2223
You can now render the list in a template:
2324
```html

docs/directory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ File / Directory | Description
4444
`_cobalt.yml` | Site-wide [configuration](/docs/config) file
4545
`_layouts` | [Templates](/docs/layouts) that wrap pages. The layout is chosen in the [frontmatter](/docs/pages)
4646
`_includes` | Liquid snippets of content to be shared among [layouts](/docs/layouts) or pages.
47-
`_data` | Data files that will be loaded as part of the `{%raw%}{{ site.data }}{%endraw%}` variable.
47+
`_data` | [Data files](/docs/data) in this directory are loaded as part of the `{%raw%}{{ site.data }}{%endraw%}` [variable](/docs/variables).
4848
`_sass` | Sass snippets that can be imported into your `.scss` files.
4949
`_site` | The output directory of cobalt. Can be modified in [`_cobalt.yml`](/docs/config).
5050
`_defaults` | `cobalt new` initializes files from here based on the collection name.

docs/variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Variable | Format | Description
3939
`site.title` | String | The title of the entire site, see [`_cobalt.yml`](/docs/config).
4040
`site.description` | String | The description of the entire site, see [`_cobalt.yml`](/docs/config).
4141
`site.base_url` | String | The URL of your site, see [`_cobalt.yml`](/docs/config). This is helpful for making absolute URLs, particularly when run within [`cobalt serve`](/docs/usage).
42-
`site.data` | Object | The merged result of [`_data`](/docs/directory) and [`site: data`](/docs/config).
42+
`site.data` | Object | The merged result of [data files](/docs/data) in the [`_data`](/docs/directory) directory and [`site: data`](/docs/config) in `_cobalt.yml`.
4343
`site.time` | DateTime | A `liquid_core::model::DateTime` representing the time of the website re-generation.
4444

4545
### Page Variables

0 commit comments

Comments
 (0)