Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add/remove elements for more clarity on the version of the docs you're on #13810

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

agilgur5
Copy link

@agilgur5 agilgur5 commented Oct 24, 2024

Motivation

In CNCF Tech Docs Office Hours on Sept 25th, a couple of items in the docs stood out as confusing or lacking clarity around versions, including the GH link and a lack of version in the header/logo/home button

Modifications

  • remove version number from GH link

  • add minor version number underneath the logo in the header (the "home" button)

    • when no version or latest, use "dev" instead, as that is more clear than "latest", per Tech Docs OH
      • unfortunately can't change the actual name in RTD though
    • this uses some hacky JS to insert the version based on the URL since there is no other way to configure this in mkdocs
      • versioning is outside of its scope, either via plugins, or in our case, RTD, so can't be done via partial either
      • organize the JS a bit more into functions at least though
  • handle sidenav vs. header on mobile

Verification

Visually inspected. See screenshots:

Before:

Header:
before header - Screenshot 2024-10-24 at 3 52 41 PM

SideNav:
before sidenav - Screenshot 2024-10-24 at 3 53 27 PM

After:

Header:
after header - Screenshot 2024-10-24 at 2 43 19 PM

SideNav:
after sidenav - Screenshot 2024-10-24 at 3 47 37 PM

Future Work

  1. Also add a floating version warning banner for old versions and latest, as mentioned in the TechDocs Office Hours (referencing Reintroduce old Docsy-overrides where needed/wanted etcd-io/website#813) as well as my own comments in Versioned documentation #11390 (comment) (referencing CD's banner)

Anton Gilgur added 3 commits October 24, 2024 14:18
- per in-line comment, this is to remove ambiguity / misleading information, as that number is always set to the latest stable release in GH and _not_ the version of the documentation a user is currently on
  - as noted in [CNCF Tech Writers Office Hours on Sept 25th](https://docs.google.com/document/d/1roexHTLCrErYjNT2NEoRsVnn_YNbQzZ1gyXNK8hXR4Q/edit?tab=t.0#heading=h.psfvntb79ssg)
  - use JS here as this is _not_ [overrideable via partial](https://squidfunk.github.io/mkdocs-material/customization/?h=java#overriding-partials):
    - the `source` partial [uses](https://github.com/squidfunk/mkdocs-material/blob/198a6801fcf687ecb4d22e5c493fdf80427bdd33/src/templates/partials/source.html#L28) a [JS component](https://github.com/squidfunk/mkdocs-material/blob/198a6801fcf687ecb4d22e5c493fdf80427bdd33/src/templates/assets/javascripts/templates/source/index.tsx#L37)
    - follows [JS customization docs](https://squidfunk.github.io/mkdocs-material/customization/?h=java#additional-javascript)

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
- another indicator of the docs version somewhere
  - as noted in [CNCF Tech Writers Office Hours on Sept 25th](https://docs.google.com/document/d/1roexHTLCrErYjNT2NEoRsVnn_YNbQzZ1gyXNK8hXR4Q/edit?tab=t.0#heading=h.psfvntb79ssg)
  - this uses some hacky JS to insert the version based on the URL since there is no other way to configure this in `mkdocs`
    - versioning is outside of its scope, either via plugins, or in our case, RTD, so can't be done via partial either
    - organize the JS a bit more into functions at least though

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
- uses the same classes, so use `querySelectorAll` instead
- handle positioning of the `versionSpan` differently in the sidenav as it doesn't appear just underneath the logo and instead appeared overlapping the title text
  - so move it to the right of the logo instead

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
@agilgur5 agilgur5 added the area/docs Incorrect, missing, or mistakes in docs label Oct 24, 2024
@agilgur5 agilgur5 requested a review from Joibel October 24, 2024 20:14
@agilgur5 agilgur5 changed the title docs: add/remove some elements for more clarity on the version of the docs you're on docs: add/remove elements for more clarity on the version of the docs you're on Oct 24, 2024
@agilgur5 agilgur5 added this to the v3.5.x patches milestone Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs Incorrect, missing, or mistakes in docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant