Create a free account to get access to additional free training videos. Enjoy this free video from CraftQuest! Create a free account to get access to additional free training videos. Join the Community

Global-Set-Powered Navigation

In this example, we create a Global Set in Craft and use it to build and manage the site navigation. The advantage here is that it allows someone, presumably the client or customer, to manage the navigation from the Craft control panel. This is helpful in some scenarios because it doesn't require the intervention of a developer or technical staff member.

In this exam­ple, we cre­ate a Glob­al Set in Craft and use it to build and man­age the site nav­i­ga­tion. The advan­tage here is that it allows some­one, pre­sum­ably the client or cus­tomer, to man­age the nav­i­ga­tion from the Craft con­trol pan­el. This is help­ful in some sce­nar­ios because it doesn’t require the inter­ven­tion of a devel­op­er or tech­ni­cal staff member.

This imple­men­ta­tion has the down­side of strad­dling sta­t­ic and ful­ly dynam­ic nav­i­ga­tion, with lim­it­ed con­trol over child nav­i­ga­tion items (like the drop-down we did in the Par­tial­ly-Dynam­ic ver­sion above).

We can han­dle this nav­i­ga­tion in a few ways because we can use any field or field type in a Glob­al Set. For this ver­sion, let’s use a Table field and man­age all nav­i­ga­tion items as table rows. 

Topic
Twig
+1 more
Instructor
Ryan Irelan
Level
Beginner
Date Published
October 05, 2021
Ryan Irelan

I am the creator of CraftQuest, a web developer, and former software team manager. I spend most of my time improving CraftQuest with code and courses. When I'm not in front of the computer, I spend my time with my family, and running on the roads and trails of Austin, TX.