Dynamic menu generated based on the content type


[%content_menu content_type:'category' sortby:'sortorder' show_empty:'1'%]
    [%param *header%]
        Category Menu
    [%param *level_1%]
        <a href="[@url@]">[@name@]</a>
        [%if [@next_level@]%][@next_level@][%/if%]
    [%param *level_2%]
        <a href="[@url@]">[@name@]</a>
        [%if [@next_level@]%][@next_level@][%/if%]
    [%param *level_3%]
        <a href="[@url@]">[@name@]</a>
    [%param *footer%]


The content menu automatically generates a navigation tree based on the content type you've selected.

Content types

In Neto by Maropost, content types are customisable page types that can have products, pages & related content added to them and sit at the core of our CMS. With this menu tag, you can call any content type you'd like for a nav menu based on the content_type parameter. By default Neto comes with a few types such as category, information pages, blogs, etc. But you can create your very own content types via Admin > Content Types Manager and use the unique ID you create to link it to a menu.

Start category, categories & you

Something that can cause a little confusion is what role these params play in b@se.

The category parameter let's you select a specific content page to generate your menu from based on the ID. So if you'd like to focus on a specific group of parent and child pages in a content type, you can target this via the id of these content pages.

The start_category does a similar thing, let's you target specific content pages to generate your menu from with one big difference - it changes how the level parameters perceive this content. So let's say you have Category A with a sub category, Category B as a child. A normal menu would print Category A as level_1 and Category B as level_2. However, if you use start_category:'10' (10 being the ID category_b has in this example), then your level_1 param now prints Category B as the "First level" category because that's where your menu starts.

** Note : ** Both these params often use the [@id@] data tag for dynamic results based on the current page.

Common uses

Below are a few quick-start configurations that are useful when building a site, keeping in mind you'll likely need to add some header / footer params to throw in some rows and other layout formatting.

Show all next level pages based on current page

Our example uses categories as the default type, but you can swap this out for other content types as needed.

[%content_menu content_type:'category' sortby:'sortorder, name' show_empty:'1' category:'[@id@]' start_category:'[@id@]'%]

Show a list of all the blogs

[%content_menu content_type:'blog' sortby:'sortorder' show_empty:'1'%]


Name Options Description
`content_type:''` String The content type you'd like to target for the menu
`limit:''` Integer Sets a limit of items generated in the menu
`sortby:''` `selected`, `name`, `sortorder`, `sortorder_asc`, `sortorder_desc` The sort order for the pages in your menu
`show_empty:''` `1`/`0` Shows empty content pages as a part of the menu
`ifempty:''` HTML & b@se tags If the type selected has no content pages, it will display this content
`category:''` String Targets a specific category to generate a menu from
`start_category:''` String Targets a specific category at any level to begin the menu from, thus changing what each `level` param references
`get_fields:''` String Add main description or any short description names here to call the data into the menu, eg. `content_short_description1` would allow the use of `[@content_short_description1@]` in the menu. Please note: If you want to get multiple fields, use the `,` value between each base tag. There must be no spaces, ie. `content_description1,content_short_description1,content_short_description2,content_short_description3`
`*header` HTML & b@se tags Renders a single usable space above the body
`*body` HTML & b@se tags Runs an array for each option in the tag
`*footer` HTML & b@se tags Renders a single usable space below the body
`*level_#` Integer Replacing the # character with a number, this will load the required level data.
`*level_#_selected` Integer Replacing the # character with a number, this will load the required level data if the current level is selected.
`*level_#_related` Integer Replacing the # character with a number, this will load the required level data if the current level is related to the selected category
Name Content Field Example Description
`[@allcount@]` 0 Counter for each result that runs in the menu on every level. Starts at **0**
`[@code@]`, `[@content_ref@]` Link ID about_us The content reference field for that page
`[@content_id@]`, `[@id@]` ID 209 The unique ID of the page
`[@content_leaf@]` y This menu option has a child option. **0** - no, **1** - yes
`[@content_level@]`, `[@level@]` 1 The current level as an integer
`[@name@]` Name About Us Page name
`[@next_level@]` Loads the next level param, ie. `[@next_level@]` in `level_1` will determine where the param `level_2` will render
`[@parent_content_id@]` Parent Content 0 The unique ID for the parent page of the content
`[@related@]` 0 Prints true if the page is related to the current page
`[@selected@]` 0 Prints true if the page is the current page.
Allows you to use logic to customise links to the page you are currently on: `[%if [@selected@]%]class="selected"[%/if%]`
`[@total@]` 1 The total number of products assigned to the page (Regardless of product state, includes sold out products)
`[@url@]` URL URL to the page

Was this article useful?

Be notified when this page is updated. Optional.