Updating Pages and Nav2:00
Maybe no lighting bolts, no panels. The slug would be the DeLorean. Next, we'll create FlexTech. FlexContent. Take the TM out of that slug. And then let's move this news and press page down to the end. We'll save those changes, and then we'll replace them in the template. Hop into our code editor. We'll go to the nav partial. Inside this URL that loops through our nav links, we're going to use the nav tag. We want to pull a nav from a collection called pages. We'll close that.
Rendering Dynamic Nav Links2:40
We want to pull a nav from a collection called pages. We'll close that. We'll hook up the link. Set the title. Remove the extra links, and we'll refresh. Let's move this FlexTech page up and save the changes. Refresh, and you can tell now for sure it is dynamic because that has updated by itself. You may be saying, but where's the homepage? Why is that not being listed there? You can't include the homepage because most sites just use the logo as the homepage. If you want that included, just add the includeHome parameter.
Adding Subpages for Dropdown4:00
You could do something like that or include your logo that way. It's up to you. What if you had subpages, like you want to do a drop down menu? Let's go through that scenario. Control Panel, and let's add maybe just a couple of basic pages underneath FlexTech. Page 1. We'll create another here. Page 1. Page 2. Page 3. Next, go back to our code editor. Each entry in this loop will have a children variable if it has children. We can do a check for if no children,
Looping Through Child Pages4:40
Each entry in this loop will have a children variable if it has children. We can do a check for if no children, and use this markup as we have it right now, else. I'll paste in some static markup here. Get rid of these extra nav items. Right here is where we're going to loop through the children. Put the title in there. If we refresh, those pages aren't very subby. Try to save a little time. Didn't save much.
