From b54544c68b96577899b6226593fd1c9f8312ab40 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 5 Sep 2019 19:33:49 +0530 Subject: [PATCH] Clarify docs for static files in collection (#7812) Merge pull request 7812 --- docs/_docs/collections.md | 15 ++++++++++++--- docs/_docs/upgrading/3-to-4.md | 7 +++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/_docs/collections.md b/docs/_docs/collections.md index e2e6ac68..2ec1dfb7 100644 --- a/docs/_docs/collections.md +++ b/docs/_docs/collections.md @@ -45,9 +45,12 @@ Create a corresponding folder (e.g. `/_staff_members`) and add documents. Front matter is processed if the front matter exists, and everything after the front matter is pushed into the document's `content` attribute. If no front matter is provided, Jekyll will consider it to be a [static file](/docs/static-files/) -and copy it to the destination (e.g. `_site`) without processing. If front matter -is provided, Jekyll will process the file in your collection but will not write to disk -unless `output: true` is set in the collection's metadata. +and the contents will not undergo further processing. If front matter is provided, +Jekyll will process the file contents into the expected output. + +Regardless of whether front matter exists or not, Jekyll will write to the destination +directory (e.g. `_site`) only if `output: true` has been set in the collection's +metadata. For example here's how you would add a staff member to the collection set above. The filename is `./_staff_members/jane.md` with the following content: @@ -60,6 +63,12 @@ position: Developer Jane has worked on Jekyll for the past *five years*. ``` + + Do note that in spite of being considered as a collection internally, the above + doesn't apply to [posts](/docs/posts/). Posts with a valid filename format will be + marked for processing even if they do not contain front matter. + +
Be sure to name your directories correctly

diff --git a/docs/_docs/upgrading/3-to-4.md b/docs/_docs/upgrading/3-to-4.md index 40e73320..5ac47a39 100644 --- a/docs/_docs/upgrading/3-to-4.md +++ b/docs/_docs/upgrading/3-to-4.md @@ -53,6 +53,13 @@ your pages and documents. The downside to this is that some of the community-authored plugins may not work as they previously used to. +## Static files in unrendered collections + +Collections other than `posts` can contain static assets along with Markdown files. +But if the collection has not been configured with metadata `output: true`, then +neither its *documents* nor its *static assets* will be output to the destination +directory. + ## For plugin authors * If your plugin depends on the following code: `site.liquid_renderer.file(path).parse(content)`,