title: Navigation --- summary: Shows how to create a dynamic navigation with Lektor. --- sort_key: 20 --- body: Websites are all about hyperlinks and being able to explore more. As such it's important to be able to provide a good navigation experience for your users. Templating in Lektor makes it very easy to make automatic navigation that keeps up to date with your pages. Most of this involves generating links with the help of the [URL Filter :ref](../urls/). ## Basic Semi-Automatic Navigation The most basic form of navigation is a semi automatic one. It's one of the most flexible ones while still being easy to maintain. It requires knowledge of which pages to show and what the link title should be: ```html+jinja ``` In this case we use a list of pages (href and title) to automatically generate some list items and we ask the current page (`this`) if it is a child of the given path. Based on that information we automatically add a class to the link. The index page requires a bit of special casing as we do not want it to be active if any of its children are active. So we just check if the path of the current page is actually the path of the index page. ## Fully Automatic Navigation Sometimes all we want is to show navigation links for all sub-pages of a page. This is easy to accomplish as well: ```html+jinja ``` ## Recursive Tree Navigation In some situations you want to show a tree like navigation. This is for instance something that comes up when building site maps. In that situation the recursive Jinja loop system comes really in. ```html+jinja ``` This above template recursively renders out a part of the tree based navigation around the current active page. For a concrete example for this: this is how the navigation of this documentation is rendered.