The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [navigation]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
16 views

Set active class on parrents in a structure?

I have a section (structure) called "blog" but "blog" is not in the URL. I have entries like: Entry 1a --Entry 1b ----Entry 1c Entry 2a ---Entry 2b A navigation like: Overview <- a template in ...
1
vote
0answers
50 views

Using CTA Buttons as Supplemental Subnav

I am a content administrator for a major US city that's using Craft CMS. The content categories for our website (i.e., Resources, Services, Topics, etc.) are great for providing different ways to ...
1
vote
1answer
28 views

Change the URL of nav child entry conditionally

I want to change the URL of a li from a nav menu conditionally (using a custom field where the user sets the URL), but I don't see how to use conditionals with {% ifchildren %}? {% nav entry in ...
2
votes
1answer
40 views

Show only children relative to current page

I have this structure section: 1.0 Nav point level 1 1.1 Nav point level 2 1.2 Nav point level 2 1.3 Nav point level 2 2.0 Nav Point level 1 3.0 Nav Point level 1 I want to show only top level ...
1
vote
2answers
77 views

Filter entries with AJAX

How would I sort blog entries displayed using AJAX? What I want to achieve is initially show all posts from a channel (All) but then let my users sort through these posts with a sub navigation using ...
1
vote
1answer
37 views

How can I filter which children I want to show in a sub navigation menu

I have a navigation menu setup but I want to filter out some of the children at level(2) so they aren't showing in the dropdown navigation menu. Here is how I am grabbing the children... {% set ...
1
vote
1answer
59 views

Filter entries by tags

Still very new to Craft but just can't figure this problem out, it's a level above me at the moment. I have an FAQ page as a 'single' that I would like to display all entries from a channel by ...
1
vote
1answer
316 views

Craft CMS Structure: How can I display parent and child items on an active parent page?

I'm currently setting up a Structure nav and am trying to set it up so that child pages only display if; 1) The child page itself (or it's sibling) is currently active 2) The parent page of that ...
1
vote
1answer
278 views

How can I display second level children only from a specific parent structure item?

I'm trying to display a list of child structure links, but only from a specific parent. The template I'm working on isn't for the parent in question so I don't think I can use 'entry.' My structure ...
1
vote
1answer
113 views

Setting plugin subnav to active

I have written a plugin that works fine, it has a subnav which i build like so: public function getCpNavItem() { $item = parent::getCpNavItem(); $item['subnav'] = [ 'moderateentries' =...
1
vote
2answers
96 views

How do I create a structure side navigation that will show active parent list-item and active child list-item

A bit of a background on the project. I have a features structure section, that has 2 levels: Parent features & Child features. {% set features = craft.entries.section('features').all() %} My ...
0
votes
0answers
29 views

Breadcrumb for channel pages: Set page?

In a site that combines a structure with some channels, I encountered the issue that the breadcrumb doesn't work when on the channel's detail page. Of course, because it doesn't know the ancestors of ...
1
vote
1answer
34 views

Access pages data with fewer queries by creating an object in Twig

I have the goal of querying the database once for page info, and then using it to display information on select pages site wide. For example, I want to link the the contact page with using a url slug ...
1
vote
0answers
44 views

Is this an ok approach to building a secondary navigation?

I have a site which has multiple menus e.g. primary and utility. I've built the menus via sections and the entry type for those sections has a title and a entry field. This site requires me to show a ...
1
vote
0answers
88 views

Eager Loading Entries - Creating a Navigation from a structure

I have a multi-level structure in Craft that is being used for navigation. As part of this I have a few different entry types, but each entry that links to a page has a entry-field of singlePage. At ...
0
votes
1answer
69 views

Conditional statement for nav tag when no children

On the menu below I need to change the class on the li from dropdown-submenu to dropdown-item for those entries that don't have children. Any ideas? Thanks {% set pages = craft.entries.section('...
1
vote
1answer
226 views

Navbar in Craft CMS

I'm currently doing some work on our new website, and I have water up to my chest. :) I'm trying to create a top navigation bar (dropdown) based on entries in CraftCSM to create the menu. I'm ...
1
vote
1answer
141 views

Dynamic Navigation with Condition to check slug

I'm trying to achieve one pretty simple thing, but putting it into my dynamic nav is making it a little difficult. I want to have a little number of the total amount of entries in my channel "listings"...
2
votes
2answers
494 views

How do I hide children of a disabled parent in a nav?

So I've got a {% nav %} I'm trying to create with the following code: {% nav page in craft.entries.section('pages') %} <li> <a href="{{ page.url }}">{{ page.title }}</a> ...
1
vote
1answer
164 views

Singles or routes solution

Most websites have three distinct types of page. List of items Item Special layout of items / content A list of entries require a list view. Craft lets us do this with singles - eg blog index page. ...
1
vote
2answers
142 views

Equivalent of “EE Pages” module in Craft?

I'm struggling to find a solution for a clients request to be given complete flexibility to create new sections and pages from within Craft. Essentially I would create a series of generic page ...
2
votes
1answer
100 views

Creating a sitemap/index page, ordered by A-Z and 0-9

I'm created an Index like page (like at the back of a book) for entries within a certain section, ordered alphabetically with the letter proceeding it. My code below seems like a tedious way to do it,...
0
votes
2answers
70 views

Image does not be shown

Good mornig I am having a problem with my bannerImage. First off i show you how i did it and what the problem is. In the first picture you can see, how i get the image. This method works fine for 3 ...
2
votes
1answer
213 views

Best Technique for have sections in display in same page with anchor link to each section

I'm currently in the process of making a website for a restaurant and using Craft CMS & I'm not sure how to go about making the menu page. It is a very complete page with a bunch of different ...
1
vote
1answer
155 views

a&m nav - activeNodeId

I have the following menu structure: as you can see, the Item "Clients" points to the same Url as its Child "Client Portfolio" does. Unfortunately this is not working for my submenu that should ...
1
vote
2answers
104 views

Add active class to nav created from globals

I have a simple nav set up using Globals in a table, but I'm struggling to get it to add an active class to only the active page. The below code adds the nav links, but I need to know what to add to ...
1
vote
1answer
41 views

Navigation to URL

My navigation looks like so: <li><a href="{{ url('http://www.mysite.com/') }}" {% if craft.request.firstSegment == 'home' %}class="active"{% endif %}>Home</a></li> <li>&...
2
votes
1answer
415 views

How to get first child URL within Craft/Twig Nav tags

I have a navigation structure as follows: {% set page = entry ?? category ?? null %} <ul class="nav menu--main"> {% nav entry in entries %} <li class="menu__item{% if page and ...
1
vote
1answer
169 views

How to use the same category group as a filter on multiple channel sections?

I have two channel sections, each with only their own entry types. I've added the same category group field to both. I'd like to filter each channel's list of entries by the same category group. So ...
2
votes
1answer
345 views

Active class on node with NAVEE

I have a simple nav tag {% set navConfig = { 'startwithActive' : true, 'maxDepth' : 2, 'activeClassOnAncestors' : true, 'ancestorActiveClass' : 'active', } %} {% nav node in ...
3
votes
1answer
391 views

Exclude certain entries and its children from navigation

I need to split up a navigaton tree. So I try to exclude certain pages from a structure based navigation tree PLUS their children automatically, but don’t seem to get it. {% nav page in craft.entries....
0
votes
1answer
328 views

Getting the URI of an Entries field in a Structure with no URLs

I am building a navigation section which is a structure. The idea is that it is a flexible place to build links to other entries/ custom urls etc. It has one entry.type called page which has an ...
1
vote
2answers
249 views

Pass active class into dropdown

I have a dynamic navigation consisting out of matrix and entries fields: This then gets printed on the frontend as a dropdown. No is it somehow possible to add a active class to the dropdown ...
0
votes
1answer
141 views

Adding section in breadcrumbs

My Entry URL Format looks like this: {section}/{slug} and I am using the standard breadcrumbs code; {% if entry.level > 1 %} <ul class="crumbs"> {% for crumb in entry....
1
vote
1answer
62 views

Homepage in Navigation

I've been trying to get the homepage to show up in the navigation... What I'd like to display is the following... <ul> <li class="nav-item active"> ...
0
votes
2answers
632 views

active state macro how to check if segment 2 is empty

I'm using a macro to check segment 1 to set an active state on my navigation and all is working correctly. However I would like to change it so that if segment_2 is not empty it doesn't display the ...
1
vote
1answer
344 views

Current Section handle

I want to build a subnav with all entries from the current Section. {% set pages = craft.entries.section(getCurrentSection).level(1) %} I'm looking for the handle "getCurrentSection". I will use ...
2
votes
2answers
306 views

Get Level 1 entry on a section as Nav

I have a template which I want to use for different sections. In my template I have this code: {% set pages = craft.entries.section('catering').level(1) %} <ul> {% for page in pages %} &...
2
votes
1answer
100 views

display entries inside nav

I'm building an overview page that will show a title, thumbnail, etc of the pages inside the structure. I want the nav children to start at the parent page we're currently on. I can get the correct ...
2
votes
1answer
85 views

Adding a random entry to an array

I have a navi on which one entry consists of a random channel entry from one section among standard singles: Single 1 Single 2 Random Channel entry Single 3 I thought about something like this: {% ...
1
vote
1answer
83 views

Using the nav tag repeat the parent once in the children

I'm using the nav tag to build a menu which works great, but i just want to repeat the parent menu item over to any sub nav. So if there is a sub nav, at the top of the sub navs links, i want the ...
5
votes
1answer
158 views

What is the difference between 'nav' and 'for' for looping?

I am new to craftcms and did a look through on the documentation just recently. I am at the part where it explain about the Categories Field and found out that we can loop through the ...
1
vote
1answer
325 views

How can I output child urls that reflect a structured menu hierarchy when the structure has no URL format specified?

I am using a structure for navigation. The structure has two fields : entry field: 'contentLink' custom link: 'customLink' These are used to create a menu structure like: About - sub item 1 - sub ...
0
votes
1answer
173 views

Navigation structure and uri problems

I am using structure type entries for navigation with three fields for navigation that uses either: -customlink field (plain text) or -category entry as the source for links. I have product ...
1
vote
1answer
269 views

Navigation Slug Issue (Structure Section)

I am trying to setup a navigation on a site. I am using a Structure Section called "pages", however, when I changed the "Top-Level Entries" to just {slug} and the nested levels to {parent.uri}/{slug}, ...
1
vote
1answer
414 views

Create a “hidden” page within Structure

Is it possible to create a hidden page within a Structure similar to how the Structure addon in EE does? It is still available at the url, but is excluded from the navigation. I know there are ...
4
votes
2answers
295 views

Large, Complex Navigation

For a while I've been having difficulty handling large navigation in craft. I built this site a while ago, and if I am honest I would probably change the structure if I was doing it again, but that's ...
1
vote
1answer
213 views

Nest Entries from Different Sections

I have 2 separate sections living in the same place on my site. Example: About (Single-type Section) Team (Structure-type Section) So in the URL I need to nest Team underneath About, i.e. /about/...
2
votes
1answer
301 views

Simple nested navigation

I'm new to Craft CMS. I have the following single level navigation code: <ul> <li> <a href="/products" class="app-nav__primary">Products</a> <ul class="app-...
1
vote
1answer
89 views

Altering Structure order doesn't update cache

I have 2 structures that are used for Menus on the site. Each entry is a link to either an entry / asset or external URL. The hierarchy is used to generate a menu . To save on page load time, the two ...