docsy-example icon indicating copy to clipboard operation
docsy-example copied to clipboard

Collapsed sidebar

Open thomseddon opened this issue 6 years ago • 5 comments

It seems that on a fresh clone of 5a51cdb6075516a3111fa0b570b2956d5c8bf21c, when I navigate to the /docs page, the list showing all the documentation sections is collapsed:

What I see:

Screenshot 2020-04-21 at 16 27 35

What I see on https://example.docsy.dev/docs/:

Screenshot 2020-04-21 at 16 27 26

Looking at the source, the line that determines if the section has the "show" css var always seems to evaluate to false for me on the /docs page https://github.com/google/docsy/tree/4ad7fb270ca02866715e350654b257b7ab99c9d4/layouts/partials/sidebar-tree.html#L25

{{ $show := or (and (not $p.Site.Params.ui.sidebar_menu_compact) ($p.IsAncestor $s)) ($p.IsDescendant $s) }}

I have made the following modification which seems to work:

{{ $show := or (or (and (not $p.Site.Params.ui.sidebar_menu_compact) ($p.IsAncestor $s)) ($p.IsDescendant $s) (eq $p.CurrentSection $s)) }}

I'm thinking that either I'm doing something wrong, or there has been a change in behaviour in hugo whereby isAncestor and isDescendant no longer evaluate true when the page is also the section. The only change I can see in relation to those functions is this https://github.com/gohugoio/hugo/commit/4a39564efe7b02a685598ae9dbae95e2326c0230 which was released in v0.69.0

If you can confirm I'm not doing something wrong then I'll submit a PR over at https://github.com/google/docsy :)

thomseddon avatar Apr 21 '20 16:04 thomseddon

Yeap, I'm facing exactly the same thing. I tried getting a fresh clone, and still the same...

Same happens in /blog/ section... I've actually done a build, before noticing anything, it's that behaviour: https://www.matscloud.com/docs/

mateja82 avatar Apr 22 '20 06:04 mateja82

I believe this is related to: https://github.com/gohugoio/hugo/issues/7178

We can await the outcome of that issue to see if hugo consider the current or previous behaviour is considered desirable, I'll submit a PR depending on the outcome of the above issue

thomseddon avatar Apr 22 '20 08:04 thomseddon

I believe this is related to: gohugoio/hugo#7178

We can await the outcome of that issue to see if hugo consider the current or previous behaviour is considered desirable, I'll submit a PR depending on the outcome of the above issue

I sure hope this isn't so... it rather looks like a BUG then a feature. For the time being, I've downgraded to 0.68.3, and it works like a charm.

mateja82 avatar Apr 22 '20 10:04 mateja82

This is SOLVED, tested this morning with hugo 0.69.2. I think you can close the Issue.

mateja82 avatar Apr 26 '20 15:04 mateja82

Confirmed this is now fixed in hugo 👍

thomseddon avatar Apr 28 '20 09:04 thomseddon