> For the complete documentation index, see [llms.txt](https://docs.devhub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devhub.com/themes-and-custom-templates/advanced-examples/schema.org-faq-utility.md).

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