canonical / canonicalwebteam.discourse

GNU Lesser General Public License v3.0
11 stars 16 forks source link

Empty lists in side nav when pages have no level #137

Closed bartaz closed 2 years ago

bartaz commented 2 years ago

In multipass after adding some hidden pages with no level the side navigation started showing a line, which is a result of many empty lists added to the navigation:

image

Part of the config:

| 1 | reference | [Reference](/t/27144) |
| 2 | alias | [Alias](/t/28409) |
| 2 | driver | [Driver](/t/28410) |
| 2 | host | [Host](/t/28493) |
| 2 | instance | [Instance](/t/28469) |
| 2 | mount | [Mount](/t/28470) |
| 2 | multipass-cli-client | [Multipass CLI client >](/t/28472) |
| 3  | multipass-cli-commands| [Multipass CLI commands](/t/29329) |
| 2 | multipass-gui-client | [Multipass GUI client](/t/28484) |
| 2 | platform | [Platform](/t/28491) |
| 2 | service | [Service](/t/28494) |
| 2 | settings-explanation | [Setting >](/t/27347) |
| 3 | get-and-set-keys | [`get` and `set` keys](/t/29326) |
| 1 | explanation | [Explanation](/t/27145) |
| 2 | exec-shells | [`multipass exec` and shells](/t/27441) |
||||
|  | | `multipass` commands |
|  | alias-command | [alias](/t/24129) |
|  | aliases-command | [aliases](/t/24131) |
|  | authenticate-command | [authenticate](/t/26500) |
|  | delete-command | [delete](/t/27322) |
|  | exec-command | [exec](/t/10851) |
|  | find-command | [find](/t/8351) |
|  | get-command | [get](/t/13735) |
|  | get-command-preview | [get (preview)](/t/27345) |
|  | help-command | [help](/t/8349) |
|  | info-command | [info](/t/10848) |
|  | launch-command | [launch](/t/10846) |
|  | list-command | [list](/t/10847) |
|  | mount-command | [mount](/t/27212) |

https://discourse.ubuntu.com/t/multipass-documentation/8294

bartaz commented 2 years ago

@jkfran Are items without the level turned into empty navigation groups by the module?

jkfran commented 2 years ago

@jkfran Are items without the level turned into empty navigation groups by the module?

Yes, that's the current behaviour. empty level = level 0: https://github.com/canonical-web-and-design/canonicalwebteam.discourse/blob/c6eaf99404e02aaade9f77255246d40e292e061d/canonicalwebteam/discourse/parsers/docs.py#L385-L387

bartaz commented 2 years ago

So how they should be hidden? In the template?

bartaz commented 2 years ago

Ah, found that in juju.is template, but it wasn't used in other templates:

          {% if not nav_group.hidden %}

I guess we need it in the default template to make hidden pages work as expected.

bartaz commented 2 years ago

Fixed in multipass via https://github.com/canonical-web-and-design/multipass.run/pull/256 but we need to update the default template documented in this project to reflect that as well.

tmihoc commented 2 years ago

The demo looks good. Thanks!