From f4f7a172165d22c6766594df47c89d6658ea651b Mon Sep 17 00:00:00 2001 From: skierpage Date: Thu, 11 Jul 2024 19:00:48 -0700 Subject: [PATCH] docs: Improve data explanation, more links --- docs/data.md | 9 +++++---- docs/directory.md | 2 +- docs/variables.md | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/data.md b/docs/data.md index 26caa23..7936592 100644 --- a/docs/data.md +++ b/docs/data.md @@ -6,9 +6,10 @@ data: --- ## Data Files -Cobalt supports loading [yaml](http://yaml.org), [json](http://json.org), and -[toml](https://github.com/toml-lang/toml.html) from [`_data`](/docs/directory) -and making it available as [`site.data..`](/docs/variables). +Cobalt reads data from any [yaml](http://yaml.org), [json](http://json.org), and +[toml](https://github.com/toml-lang/toml.html) files in the [`_data` directory](/docs/directory) +and merges them into the [`site.data`](/docs/variables) variable, making +them available as `site.data..`. ### Example @@ -17,7 +18,7 @@ In `_data/animals/dogs.yml`: - name: Corgi - name: Malamute ``` -which can be accessed via `site.data.animals.dogs`. +which liquid templates can access via `site.data.animals.dogs`. You can now render the list in a template: ```html diff --git a/docs/directory.md b/docs/directory.md index 31dbdac..a4214cd 100644 --- a/docs/directory.md +++ b/docs/directory.md @@ -44,7 +44,7 @@ File / Directory | Description `_cobalt.yml` | Site-wide [configuration](/docs/config) file `_layouts` | [Templates](/docs/layouts) that wrap pages. The layout is chosen in the [frontmatter](/docs/pages) `_includes` | Liquid snippets of content to be shared among [layouts](/docs/layouts) or pages. -`_data` | Data files that will be loaded as part of the `{%raw%}{{ site.data }}{%endraw%}` variable. +`_data` | [Data files](/docs/data) in this directory are loaded as part of the `{%raw%}{{ site.data }}{%endraw%}` [variable](/docs/variables). `_sass` | Sass snippets that can be imported into your `.scss` files. `_site` | The output directory of cobalt. Can be modified in [`_cobalt.yml`](/docs/config). `_defaults` | `cobalt new` initializes files from here based on the collection name. diff --git a/docs/variables.md b/docs/variables.md index 1ca7f64..95f1cad 100644 --- a/docs/variables.md +++ b/docs/variables.md @@ -39,7 +39,7 @@ Variable | Format | Description `site.title` | String | The title of the entire site, see [`_cobalt.yml`](/docs/config). `site.description` | String | The description of the entire site, see [`_cobalt.yml`](/docs/config). `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). -`site.data` | Object | The merged result of [`_data`](/docs/directory) and [`site: data`](/docs/config). +`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`. `site.time` | DateTime | A `liquid_core::model::DateTime` representing the time of the website re-generation. ### Page Variables