coderedcorp / coderedcms

Wagtail + CodeRed Extensions enabling rapid development of marketing-focused websites.
https://www.coderedcorp.com/cms
Other
686 stars 133 forks source link

Additional blocks for navbar template customization #379

Closed thenewguy closed 4 months ago

thenewguy commented 3 years ago

The navigation bars snippet and rendering is quite slick and functional.

One complicated area I've encountered is attempting to output breadcrumb navigation for nested pages to offer easier hierarchy traversal.

The Navbar snippet is pretty useful as-is so I am hesitant to ask for it to be made more complicated with multiple rendering options. I think it would be pretty simple and useful to add additional blocks to the navbar template

Perhaps before Navbar snippets are rendered. After each Navbar is rendered with access to the {{ forloop }} variable or iteration count. After all navbars / before & after the search bar.

It would also be nice to have a template block for css classes on the search bar.

vsalvino commented 3 years ago

I agree with more template blocks in the navbar HTML template in general. Feel free to make a pull request!

As far as breadcrumbs go... that would be purely up to the developer. You can easily access the page's ancestry from the page object, and loop through that in the page's template. I don't think that belongs in the navbar as the navbar is page-agnostic. Otherwise, you can create your own custom navbar template to achieve this.

thenewguy commented 3 years ago

@vsalvino breadcrumbs was just an example that would be possible if there were mote template blocks to customize the output on a per site basis. I think they should be easy to implement in the template or with a template tag and injected via template overrides. I will tweak a local copy and submit a PR

vsalvino commented 4 months ago

In practice we normally end up building custom navbars for each site.

In the next release, we are going to provide the ability to disable the built-in navbar, and also provide a pre-built custom navbar. Follow the example in the upcoming "pro" project here: (look in website/models.py and website/templates/website/): https://github.com/coderedcorp/coderedcms/tree/main/coderedcms/project_template/pro