Bug 14115 - Improve the support for multiple versions on the docs website
Summary: Improve the support for multiple versions on the docs website
Status: RESOLVED FIXED
Alias: None
Product: General Docs
Classification: Documentation
Component: docs-general (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 3.4 M1
Assignee: Nicolas Dechesne
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2020-11-04 23:25 UTC by Nicolas Dechesne
Modified: 2021-04-23 06:56 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Dechesne 2020-11-04 23:25:55 UTC
On docs.yp.org, we now have a drop down menu so that we can easily access any YP docs versions. The list of 'versions' that we expose in the drop down menu is currently set in the file ./documentation/sphinx-static/switchers.js, which contains the implementation of this drop down menu.

At the moment, the list of 'versions' is set like this:

  var all_versions = {
    'dev': 'dev (3.3)',
    '3.2': '3.2',
    '3.1.3': '3.1.3',
    '3.0.4': '3.0.4',
    '2.7.4': '2.7.4',
  };


This JS file is distributed every time we build and publish the docs. However we publish the docs in several locations on docs.yp.org:

* ./ (master branch)
* ./0.9 to ./3.1, each containing a copy of the 'docs' for the old releases
* ./gatesgarth, ./<branch> for each release branch
* ./3.2, ./3.2.1, ... for each release we've done

So we end up with many copies of switchers.js, and they must contain the same value for "all_versions". 

The purpose of this bug is to separate the list of "versions" from the implementation of switchers.js. Ideally, we should have a 'versions.yaml' file hosted independently from yocto-docs.git (e.g. at the root of docs.yp.org), YP release manager would maintain this file which would dictate which versions are presented to end users in the drop down menu.

switchers.js has another feature. It adds a 'red/warning' banner when an end user is looking at YP docs from an EOL release. It's implemented in JS as:

    if (ver_compare(release, "3.1") < 0) {
      $('#outdated-warning').html('Version ' + release + ' of the project is now considered obsolete, please select and use a more recent version');
      $('#outdated-warning').css('padding', '.5em');
    } else if (release != "dev") {

We should also remove the '3.1' from the implementation, and move that information in 'version.yaml', e.g. include a flag there to indicate if a version is 'obsolete' or not. 

Once both of these changes are made, switchers.js should be generic, and having multiple copies in each instance of published docs, should no longer be an issue. there are many other files duplicated, like CSS stylesheet.. if we make bug fixes/changes in switchers.js we will decide whether we need back backport on other branches.
Comment 1 Michael Halstead 2021-04-22 23:10:02 UTC
https://git.yoctoproject.org/cgit/cgit.cgi/yocto-autobuilder-helper/tree/scripts/run-docs-build#n97 resolves this issue by replacing the switchers.js for each build with the version from the master branch. Please reopen with more information if that is not the case.
Comment 2 Nicolas Dechesne 2021-04-23 06:56:13 UTC
I think the fact that we override switchers.js is a workaround for the problem, but not the proper fix intended in my first comment on that bug.. I would prefer we keep that open until it's properly fixed. what do you think?