# Schema.org FAQ utility

![Example Schema.org structure that it generated](/files/-MYfJjH2E3cD6Khgavh5)

## Basic usage example

`faq_items` in this example is hard-coded. But you would replace with your own data fields.

```markup
{% set faq_items = [
    {
        'answer_text': 'Answer to question 1',
        'question_name': 'Question 1?'
    },
    {
        'answer_text': 'Answer to question 2',
        'question_name': 'Question 2?'
    }
] %}

<script type="application/ld+json">
{{ faq_items|as_faq_schema|tojson|safe }}
</script>
```

## Using custom field data example

Looping over some custom field values to generate the FAQ items.

```markup
{% set faq_items = [] %}
{% for i in range(1, 5) %}
  {% set title_value_key = 'faq_title_text_%s' % i %}
  {% set description_value_key = 'faq_description_text_%s' % i %}
  {% if site.custom_fields[title_value_key] %}
    {% do faq_items.append({
        'question_name': site.custom_fields[title_value_key],
        'answer_text': site.custom_fields[description_value_key]
    }) %}
  {% endif %}
{% endfor %}

<script type="application/ld+json">
{{ faq_items|as_faq_schema|tojson|safe }}
</script>
```


---

# Agent Instructions: 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://docs.devhub.com/themes-and-custom-templates/advanced-examples/schema.org-faq-utility.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.
