<p>Instead of using one separate query for each page, use just one query to get all pages and then iterate through them:</p>
<pre class="lang-twig prettyprint-override"><code>{% set pages = craft.entries()
    .section(['page1', 'page2', 'page3'])
    .all();
%}

&lt;ol&gt;
    {% for page in pages %}
        &lt;li&gt;&lt;a href=&quot;{{ page.getUrl() }}&quot;&gt;{{ page.title }}&lt;/a&gt;&lt;/li&gt;
    {% endfor %}
&lt;/ol&gt;
</code></pre>
<p>(Sidenote: You'll want to use <code>ul</code> or <code>ol</code> for lists so your HTML has a better semantic structure).</p>
<p>You can control the order of the query with the <a href="https://craftcms.com/docs/3.x/entries.html#orderby" rel="nofollow noreferrer"><code>orderBy</code> parameter</a>.</p>

CC BY-SA 4.0
2022-02-22T10:04:10.560Z
Thank you so much, exactly what I was looking for.
Samuel
CC BY-SA 4.0
2022-02-22T08:53:15.737Z
2022-02-22T08:53:15.737Z
MoritzLost
<p>I was wondering if there is a more efficient way, performance side, to call multiple urls for a navigation element in case of a multi language site (so static links are not an option).</p>
<pre><code>&lt;div&gt;
  &lt;span&gt;&lt;a href=&quot;{{ craft.entries.section(&quot;page1&quot;).one().url }}&quot;&gt;Page 1&lt;/a&gt;&lt;/span&gt;
  &lt;span&gt;&lt;a href=&quot;{{ craft.entries.section(&quot;page2&quot;).one().url }}&quot;&gt;Page 2&lt;/a&gt;&lt;/span&gt;
  &lt;span&gt;&lt;a href=&quot;{{ craft.entries.section(&quot;page3&quot;).one().url }}&quot;&gt;Page 3&lt;/a&gt;&lt;/span&gt;
&lt;/div&gt;
</code></pre>
<p>The code above is generating alone 7 new queries, why 7?</p>

<navigation><performance><queries>
Multiple entries urls performance
# Multiple entries urls performance

(Asked by: username_0 on 2022-02-21)

I was wondering if there is a more efficient way, performance side, to call multiple urls for a navigation element in case of a multi language site (so static links are not an option).

  Page 1
  Page 2
  Page 3


The code above is generating alone 7 new queries, why 7?

**Tags:** navigation, performance, queries


---

## 1 answers

### Answer by username_1 on 2022-02-22. Score: 0 | Accepted answer

Instead of using one separate query for each page, use just one query to get all pages and then iterate through them:
{% set pages = craft.entries()
    .section(['page1', 'page2', 'page3'])
    .all();
%}


    {% for page in pages %}
        {{ page.title }}
    {% endfor %}


(Sidenote: You'll want to use ul or ol for lists so your HTML has a better semantic structure).
You can control the order of the query with the orderBy parameter.

> **Comments:**
> **username_0**: Thank you so much, exactly what I was looking for.  

---

