hlxsites / prisma-cloud-docs-website

blocks and gdoc authored content for https://docs.prismacloud.io
Apache License 2.0
3 stars 2 forks source link

Left nav - nested entries #90

Closed iansk closed 1 year ago

iansk commented 1 year ago

In the Prisma Cloud Compute Edition Public Sector book, the sections under "Release Findings" aren't properly nested:

left-nav-nested-entries

All version (XX.YY.ZZZ) entries in this section should be at the same level, i.e.

Release Findings
- Methodology
- 22.12.415
- 22.06.224
- 22.06.197
- 22.06.179
- 22.01.880
- etc
- etc

Repro:

  1. Go to Release Findings.
  2. Expand the Release Finding section.
  3. Notice that you only see two entries: "Methodology" and "22.12.415".
  4. Expand "22.12.415".
  5. Notice that "22.06.224" is nested under "22.12.415". It should be at the same level as "22.12.415".
  6. Expand "22.12.415". Notice the same issue.

Expected results:

For reference, see how the ToC is structured for this section on our current doc site: https://docs.paloaltonetworks.com/prisma/prisma-cloud/prisma-cloud-compute-edition-public-sector/Release_Findings

maxakuru commented 1 year ago

@iansk the format the docs.paloalto link is slightly different than what we can do with the data, without adding specific handling for this case. could you check this out and see what you think: https://github.com/hlxsites/prisma-cloud-docs-website/pull/93

iansk commented 1 year ago

@maxakuru https://github.com/hlxsites/prisma-cloud-docs-website/pull/93 looks good. Just a couple of comments:

Comment 1:

There seems to be a regression, which was fixed in https://github.com/hlxsites/prisma-cloud-docs-website/issues/40. Essentially, the first topic in a section is what should be loaded when you click on the section entry in the nav.

For example, the Public Section book.yml has this entry:

- name: 22.01.840
  dir: v22_01_840
  topics:
  - name: v22_01_840
    file: v22_01_840.adoc
  - name: Scan results
    file: scan_results_22_01_840.adoc
  - name: Console vulnerabilities
    file: console_vulnerabilities.adoc
  - name: Defender vulnerabilities
    file: defender_vulnerabilities.adoc

The v22_01_840.adoc file should be loaded/rendered when you click on 22.01.840 in the left nav. It shouldn't be listed as a separate topic. See the following screenshot:

issue-90-toc

Comment 2:

I just noticed we've got a corner case in our book.yml, and I'm not sure if your code covers it. Essentially, our book.yml defines a section that's only contains on topic. We should treat it the same as above, i.e. render an entry in the ToC named 22.12.415. When you click on it, it loads/renders V22_12_415.adoc. Ideally, for these "one topic sections", you'd hide the chevron.

- name: 22.12.415
  dir: v22_12_415
  topics:
  - name: Scan results
    file: V22_12_415.adoc
issue-90-comment2
maxakuru commented 1 year ago

@iansk right now the logic is to render all topics under a chapter (or parent topic) as a child, except for if the name of both the parent and child are identical.. in those cases we hide the child and only use the parent as the link

for 1: we could add checks for any permutation of file/name/dir matching, but that's 4 ways to reach that state instead of 1 and may lead to cases that aren't intended to be hidden. imo just renaming name: v22_01_840 to match name: 22.01.840 would be doing same with less

for 2: we can add the same hiding logic for "one child sections".. I don't see any cases where you would want a single child to exist there

iansk commented 1 year ago

@maxakuru

For 1: Totally agree, section name and the first topic's name should always be identical. You don't need to do anything else here. It's all working. See:

https://main--prisma-cloud-docs-website--hlxsites.hlx.page/prisma/prisma-cloud/en/compute/public-sector/release-findings/v22-01-840/v22-01-840?branch=ian-fix-pub-sector-toc

For 2: What's the logic for handling this now?

I changed the book.yml from this:

- name: 22.12.415
  dir: v22_12_415
  topics:
  - name: Scan results
    file: V22_12_415.adoc

To this:

- name: 22.12.415
  dir: v22_12_415
  topics:
  - name: 22.12.415
    file: V22_12_415.adoc

Now when you click on the section entry here:

https://main--prisma-cloud-docs-website--hlxsites.hlx.page/prisma/prisma-cloud/en/compute/public-sector/release-findings/v22-12-415?branch=ian-fix-pub-sector-toc

You get redirected here:

https://main--prisma-cloud-docs-website--hlxsites.hlx.page/prisma/prisma-cloud/en/compute/not-applicable/public-sector/disa-stig/disa-stig?branch=ian-fix-pub-sector-toc

Something's not quite working right...

maxakuru commented 1 year ago

@iansk fixed this in #109 - was just a case of bad links for the parent topic when removing the single child subtopics underneath them

there are now still some semi-duplicated items in the sidenav:

Screenshot 2023-06-26 at 3 02 31 PM

but that's not a bug in the sidenav logic, just more cases where the content in book.yml needs to be updated to match between parent/child.. this is currently case sensitive fyi, which is why the 2nd one is still duplicated