diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2018-04-09 14:42:08 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2018-04-09 19:00:22 +0300 |
commit | 764239468a728daae24e947a4c7484ebef5e8689 (patch) | |
tree | 0f0e3956482ee6c6b270fcff44c1730e4f6c27f5 /README.md | |
parent | abbafef38451c233df92d83e57b4cf46ce677a36 (diff) |
Add dynamic archives
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -29,6 +29,7 @@ The [deployment process](#deployment-process) happens automatically every hour. - [Preview the Docs website](#preview-the-docs-website) - [Preview on mobile](#preview-on-mobile) - [Contributing to the docs website itself](#contributing-to-the-docs-website-itself) +- [Using YAML data files](#using-yaml-data-files) - [Review Apps for documentation merge requests](#review-apps-for-documentation-merge-requests) - [Deployment process](#deployment-process) @@ -284,6 +285,38 @@ run without manual intervention, run: RAKE_FORCE_DELETE=true rake pull_repos ``` +## Using YAML data files + +The easiest way to achieve something similar to +[Jekyll's data files](https://jekyllrb.com/docs/datafiles/) in Nanoc is by +using the [`@items`](https://nanoc.ws/doc/reference/variables/#items-and-layouts) +variable. + +The data file must be placed inside the `content/` directory and then it can +be referenced in an ERB template. + +Suppose we have the `content/_data/versions.yaml` file with the content: + +```yaml +versions: +- 10.6 +- 10.5 +- 10.4 +``` + +We can then loop over the `versions` array with something like: + +```erb +<% @items['/_data/versions.yaml'][:versions].each do | version | %> + +<h3><%= version %></h3> + +<% end &> +``` + +Note that the data file must have the `yaml` extension (not `yml`) and that +we reference the array with a symbol (`:versions`). + ## Review Apps for documentation merge requests If you are contributing to GitLab docs read how to create a Review App with each |