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

[DO NOT MERGE] POC - unique versioning for some sections of the docs #906

Closed
wants to merge 5 commits into from

Conversation

pepopowitz
Copy link
Collaborator

@pepopowitz pepopowitz commented May 13, 2022

This PR will not be merged.

It's a proof of concept for how we could implement multi-versioning within the docs -- most of the docs use one versioning scheme, while some sections (Optimize, in this example) use a different one.

Demo of how this PR affects navigating the docs

@pepopowitz pepopowitz marked this pull request as draft May 13, 2022 21:59
Copy link
Collaborator Author

@pepopowitz pepopowitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding notes to help explain the changes.

@@ -63,7 +63,7 @@ With [Tasklist](../tasklist/introduction.md), process owners can achieve end-to-

### Optimize

[Optimize](../optimize/what-is-optimize.md) leverages process execution data to continuously [provide actionable insights](../../guides/improve-processes-with-optimize.md). Optimize specializes in BPMN-based analysis and can show users exactly what their process model needs for successful execution.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually didn't think to make this change -- VS code made it for me. But yes, we will be moving a whole bunch of content from one URL "folder" to another, so there will be a lot of content updates like this.

@@ -31,6 +31,23 @@ module.exports = {
},
],
"./static/plugins/bpmn-js",

[
"@docusaurus/plugin-content-docs",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're adding a second instance of the docs plugin. We can choose the base paths here, but for this POC it made sense to just use "optimize" since that was the only section I was moving.

If we have other components that use a third versioning scheme, which I think might be the case, we'd add a third docs instance here.

Comment on lines +42 to +47
lastVersion: "current",
versions: {
current: {
label: `latest`,
},
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the settings that allow us to "pretend that the current version is a cut version", as indicated in the docs. This is nothing different from how we're doing it for the current docs.

But I'm adding a note here because I think I may have a follow-up POC that changes this to the 1st scenario described in those docs, and the approach that docusaurus takes, to treat the "current" version as "next/under-construction", and the "latest" version as the most highly-numbered release. Why? One issue I think we'll have with this work is the quantity of work involved to move all those docs over to the new section of the site. I think that if we were to switch over to this approach of having a "next/under-construction" version of the docs, we could work iteratively toward moving everything over to the right place, instead of having to do something like a long-living/very-large branch.

@@ -4,6 +4,8 @@ title: What is Optimize?
description: "Leverage process data and analyze areas for improvement."
---

Yoooo this is version `latest`!!!
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this marker here, and in the other versions, so that I could see clearly which docs I was viewing.

Comment on lines +5 to +9
{
type: "link",
label: "Overview Components",
href: "/docs/components",
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be time-consuming work, and probably difficult to maintain.

We'll have one sidebars file for each "docs instance" -- in this case, one for the main docs, and one for the optimize section. If we want to maintain the current structure of our docs navigation, we'll basically duplicate the main sidebars into this one -- except the links that cross over from one section to the other need to be rewritten using the non-shorthand format, like this. The shorthand format only works when the link target is within the same docs instance.

This is going to result in duplication of page titles, and also just be kind of annoying. I wonder if we could create a plugin that allows us to write in the shorthand format with some kind of token, and looks up/rewrites the information from the other docs instance.

@@ -0,0 +1,41 @@
---
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the path in this file -- optimize_versioned_docs/version-3.8.1. This is, I think, what we're looking for -- we can use different versions for these docs than the rest of the components.

Many files after this one are the same deal -- moving into the new sections of the site.

@@ -0,0 +1 @@
["3.9.0", "3.8.1"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The versions for the optimize section are defined here, in a separate file, which is what allows us to use different versions for the two different sections.

Note that the name of this file is important, and is based on the name of the second docs plugin instance.

Comment on lines +1 to +2
// POC note: the majority of links in this file are within the same
// docs instance, so they can use the "shortcut" format.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is from the main docs site, so it's like the inverse of the other sidebars file in that most of the links here can be shortcut. Only the ones that bounce over to the optimize section need to be in the long format.

Comment on lines +1 to +2
import OriginalDefaultNavbarItem from "@theme-original/NavbarItem/DefaultNavbarItem";
export default OriginalDefaultNavbarItem;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was fun, I learned all about the concept of "swizzling", which is how we customize core docusaurus bits.

In this file, and several below it, we're literally wrapping the original docusaurus implementation. This seems silly, but we have to do it, because further down we want to override the implementation of another component in this same folder. If you replace one item inside of NavbarItem, you have to replace all of them. And since we don't actually want to change the implementation, we wrap them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I also learned that it's not just a made-up word)

@@ -0,0 +1,29 @@
import React from "react";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But here we do want to change the implementation, of the NavbarItem itself. The versions that appear in the navbar dropdown should vary depending on which section of the site you're visiting.

This component checks the current path, and if it pattern matches to the optimize section, sends the new docs plugin ID through to the version dropdown. Every other page falls back to the main docs versions.

@pepopowitz
Copy link
Collaborator Author

Closing this as it's for POC purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant