> For the complete documentation index, see [llms.txt](https://docs.astrotomic.info/stancy/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.astrotomic.info/stancy/basics/content.md).

# Content

Stancy uses [spatie/sheets](https://github.com/spatie/sheets) to parse your data files. This allows you to use Markdown (with YAML frontmatter), JSON or YAML files.

## Collections

Before you can start creating content you have to configure your collection(s).

{% code title="config/sheets.php" %}

```php
<?php

use Spatie\Sheets\ContentParsers\JsonParser;

return [
    'default_collection' => 'static',

    'collections' => [
        'static',
        'blog',
        'data' => [
            'content_parser' => JsonParser::class,
            'extension' => 'json',
        ],
    ],
];
```

{% endcode %}

The above configuration will add three collections `static`, `blog` and `data`. The first two use the markdown with YAML frontmatter by default but the `data` collection uses JSON.

## Sheets

The single files in a collection are called "sheet". You have full control over the content of your sheets.

### predefined Variables

Pages use some predefined variables which you can use to tell the page how to handle the data.

* `_view` defines the view to use if the page get's rendered
* `_pageData` defines the [PageData](/stancy/basics/pagedata.md) class to use
* `_sheets` defines a list of additional sheets or collections to load

{% tabs %}
{% tab title="static/blog.md" %}

```yaml
---
_view: page.blog
_pageData: \App\Pages\Blog
_sheets:
    posts: blog:*
---

# Blog
```

{% endtab %}

{% tab title="blog/first-post.md" %}

```yaml
---
_view: blog.post
_pageData: \App\Pages\Post
title: my first post
---
```

{% endtab %}

{% tab title="blog/second-post.md" %}

```yaml
---
_view: blog.post
_pageData: \App\Pages\Post
title: my second post
---
```

{% endtab %}
{% endtabs %}

These markdown files with YAML frontmatter will generate the following array that's passed to your view.

```php
[
    'slug' => 'blog',
    'contents' => '<h1>Blog</h1>',
    'posts' => [
        [
            'slug' => 'first-post',
            'title' => 'my first post',
        ], 
        [
            'slug' => 'second-post',
            'title' => 'my second post',
        ]
    ]
]
```

{% hint style="info" %}
This example array does not respect the defined page data classes. Head to the [PageData](/stancy/basics/pagedata.md) page to learn more about them and what you can do with them.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.astrotomic.info/stancy/basics/content.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
