Alias The Current Item#
{{ fetch "https://api.example.com/reviews" path="items" as review }} <article> <h2>{{ review.title }}</h2> <p>{{ review.author.name }}</p> </article>{{ /fetch }}as review means each JSON item can be read through review.
That makes the source easier to scan, especially when the fetch block sits inside another loop.
Without An Alias#
Without as, you can read item values directly:
{{ fetch "https://api.example.com/reviews" path="items" }} <article>{{ title }}</article>{{ /fetch }}This is fine for small blocks.
With An Alias#
Use an alias when names could be unclear:
{{ query:posts limit="3" }} {{ fetch "https://api.example.com/reviews?post={{ slug }}" as review }} <p>{{ review.title }}</p> {{ /fetch }}{{ /query:posts }}Here {{ slug }} comes from the current WordPress post, while {{ review.title }} comes from the API response.