> For the complete documentation index, see [llms.txt](https://mikefarah.gitbook.io/yq/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mikefarah.gitbook.io/yq/usage/front-matter.md).

# Front Matter

`yq` can process files with `yaml` front matter (e.g. jekyll, assemble and others) - this is done via the `--front-matter/-f` flag.

Note that `yq` only processes the first passed in file for front-matter. If you'd like to process multiple files, you can:

```bash
find -name  "*.md" -exec yq --front-matter="process" '.updated_at = now' {} \;
```

## Process front matter

Use `--front-matter=process` to process the front matter, that is run the expression against the `yaml` content, and output back the entire file, included the non-yaml content block. For example:

File:

```
---
a: apple
b: bannana
---
<h1>I like {{a}} and {{b}} </h1>
```

The running

```
yq --front-matter=process '.a="chocolate"' file.jekyll
```

Will yield:

```
---
a: chocolate
b: bannana
---
<h1>I like {{a}} and {{b}} </h1>
```

## Extract front matter

Running with `--front-matter=extract` will only output the yaml contents and ignore the rest. From the previous example, if you were to instead run:

```
yq --front-matter=extract '.a="chocolate"' file.jekyll
```

Then this would yield:

```
---
a: chocolate
b: bannana
```


---

# 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:

```
GET https://mikefarah.gitbook.io/yq/usage/front-matter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
