I have created a global menu for my website and there I have a label and an entry section selection that I use for directing when clicking.

However, I just need the URL of that section and loading the whole section data is way too much overhead that its not needed.

I have 4-5 menu items so I am loading 4-5 sections for no reason. Imagine the overhead.

Can I somehow use the section selector in CMS but get only the section URL without loading all the section data?


Are you experiencing performance issues? If not, is this overhead really an issue?

If it is, how about caching the global menu for a really long time? https://craftcms.com/docs/templating/cache


I'm not sure this would create much overhead, but everyone's setup is different.

Try this test. Enable Dev Mode, and create a test template with the following code:

{% for section in craft.sections.getAllSections() %}
    {{ section.name }}: {{ section.getUrlFormat() }}<br>
{% endfor %}

Then load this up in a browser and look at the JavaScript console. You should see entries starting with "Profiling Summary Report" that will list execution time, memory and total queries.

Running this code locally on the Happy Lager demo site, I get these results:

Profiling Summary Report
  Time:   0.30656s
  Memory: 10,799Kb
  Total Queries: 19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.