-
Notifications
You must be signed in to change notification settings - Fork 166
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
feat: versioned docs dropdown #3226
Conversation
✅ Deploy Preview for docs-kargo-io ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3226 +/- ##
=======================================
Coverage 52.05% 52.05%
=======================================
Files 295 295
Lines 26695 26695
=======================================
Hits 13895 13895
Misses 12041 12041
Partials 759 759 ☔ View full report in Codecov by Sentry. |
605f72b
to
fb61a6b
Compare
I see that this is based on what @rpelczar had linked you to, but this process is frankly much too onerous and prone to human error. It doesn't satisfy this requirement that I included in #3171:
This would introduce no new complications or process changes. Edit: I had been under the impression that Docusaurus had built-in support for that approach, but it appears not. It's possible that a plugin exists for this. If not, I think this would be a very easy plugin to write. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
I looked for one and didn't find one. It doesn't mean it's not our there somewhere. Rolling our own is really not too bad. It could probably be as simple as:
After this is working to our satisfaction in main, we'd backport it to release-1.1 and release-1.0. |
I do not have access to Netlify, which made it tough for me to understand how the separate release doc is being built and deployed to their respective subdomains. I’ve noticed that this pattern of subdomain-based doc only works for some versions, which reinforces the inconsistencies in the deployment process. like, while https://release-1-1.docs.kargo.io works, https://release-1-0.docs.kargo.io does not. seems not every version has been built and deployed to its subdomain, and I may need access to Netlify to run the build process for each missing versions. Hence, i opted to work directly with Rafal’s suggestion, it simplifies the process by treating each release as a separate static site with its subdomain. I will start working on the custom plugin that could detect the current doc version, fetch available versions from github and provide a dropdown (with doc redirection) for users to switch between versions |
@fykaa don't get caught up in building or deploying docs. Please just assume that for every branch release-x-y with x > 1, the subdomain will exist. If one of them does not, I can fix it. The reason that the 1.0 docs don't currently exist has to do with the migration we did from docs.kargo.akuity.io to docs.kargo.io. iirc, there were some changes related to the domain change that didn't get backported that far, so I just didn't deploy them. I'll investigate and fix it. |
It was dumber than that. Something just got stuck on their end during the migration. Should be all set now. All of the following exist:
|
76e88ae
to
8f4b86e
Compare
const fetchVersions = async () => { | ||
try { | ||
console.log("Before fetching versions") | ||
const response = await fetch(githubApiUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you look in local storage instead of unconditionally making this request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a valid point, and I did consider using local storage caching. but in this case I opted not to because the fetchVersions
function is only called once when the dropdown component is initially rendered. since we’re only making a single API call to fetch the data, which is then reused on subsequent renders, I felt caching might not be strictly necessary. the network tab also shows that the API call isn't repeated.
But I’m open to revisiting this if it turns out we need to optimize further by caching the branches for, say 30 minute?. Currently, API calls are only made when the page is Refreshed.
f489cc5
to
fa6a2f6
Compare
8e94c3d
to
91c4022
Compare
Signed-off-by: Faeka Ansari <faeka6@gmail.com> clean plugin code Signed-off-by: Faeka Ansari <faeka6@gmail.com> make version picker a component instead of a plugin Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com> remove accidental/unnecessary comma Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com> add caching and filtering logic Signed-off-by: Faeka Ansari <faeka6@gmail.com> optimise component Signed-off-by: Faeka Ansari <faeka6@gmail.com> address review Signed-off-by: Faeka Ansari <faeka6@gmail.com> dropdown title sync Signed-off-by: Faeka Ansari <faeka6@gmail.com> styling dropdown Signed-off-by: Faeka Ansari <faeka6@gmail.com> minor cleanup Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
cd8408d
to
956a43b
Compare
Signed-off-by: Faeka Ansari <faeka6@gmail.com>
Signed-off-by: Faeka Ansari <faeka6@gmail.com> Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com> (cherry picked from commit 0800734)
Successfully created backport PR for |
Signed-off-by: Faeka Ansari <faeka6@gmail.com> Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com> (cherry picked from commit 0800734)
Successfully created backport PR for |
Signed-off-by: Faeka Ansari <faeka6@gmail.com> Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com> (cherry picked from commit 0800734)
Successfully created backport PR for |
Signed-off-by: Faeka Ansari <faeka6@gmail.com> Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Faeka Ansari <faeka6@gmail.com> Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Faeka Ansari <faeka6@gmail.com> Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
closes #3171
This pull request implements a version dropdown in the Docusaurus configuration (
docusaurus.config.js
) to support versioned documentation. The following changes were made:Added version dropdown to Navbar:
docusaurus.config.js
to include adocsVersionDropdown
in the navbar letting users to switch between different doc versionsVersioned doc creation:
npm run docusaurus docs:version <version>
for each version (1.0
,1.1
) to generate versioned docs.versions.json
file to include the new versions.Next Steps: update release procedure
npm run docusaurus docs:version <version>
should be added to the release procedures