1

I am new to Craft.. I created the Entries but didn't understood how to setup them to display as a menu. Seen the documentation, templating references.. But not get any idea about how to add navigation menu for the entries type. I am using the default template.

Thanks

1 Answer 1

2

I'm assuming that you are trying to create an 'index' page for your channel entries. There are a few ways to do this depending on the requirements of your site, but a very simple way is to create a 'single'. In the template for the single you can request the channel entries, and loop through the response to generate your index navigation.

{% set entries = craft.entries.section('myChannelSectionHandle').limit(null) %}
<ul>
    {% for entry in entries %}
        <li><a href="{{ entry.url }}">{{entry.title}}</a></li>
    {% endfor %}
</ul>

If you want the uri's to match up nicely then you can set the 'uri' of the single to be mySectionName and the 'uri' of the channel entries to be mySectionName/{slug} in the section settings — such that to the end user, it will simply feel like they are all part of the same section.

For some slightly more complex options, see these answers, here and here.

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.