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

Re-organizing API documentation collections #169

Merged
merged 7 commits into from
Jul 6, 2023

Conversation

ElliotFriend
Copy link
Contributor

@ElliotFriend ElliotFriend commented Jun 30, 2023

These changes make it a bit more manageable to collect our various API specifications into a single navbar item in our docusaurus site. With the upcoming addition of the Hubble information (#167), this will ease the implementation, and make things a bit more uniform.

  • I've included some nginx rewrites that I think will do the correct redirections from any old URLs to the new ones.
  • There is now a single API dropdown menu item in the site's navbar, instead of having separate navbar links for all the various APIs, we can now collect them under a single button.
  • The DocSidebar component has been swizzled to allow us to keep the "category" of API used in the breadcrumbs, but to not clutter the sidebar with extra (and unnecessary) links.

These changes make it a bit more manageable to collect our various
API specifications into a single navbar item in our docusaurus site.
With the upcoming addition of the Hubble information, this will
ease the implementation, and make things a bit more uniform.

- I've included some nginx rewrites that I _think_ will do the
  correct redirections from any old URLs to the new ones.
- There is now a single `API` dropdown menu item in the site's
  navbar, instead of having separate navbar links for all the
  various APIs, we can now collect them under a single button.
- The `DocSidebar` component has been swizzled to allow us to keep
  the "category" of API used in the breadcrumbs, but to not
  clutter the sidebar with extra (and unnecessary) links.

Signed-off-by: Elliot Voris <[email protected]>
@stellar-jenkins
Copy link

Something went wrong with PR preview build please check

@ElliotFriend
Copy link
Contributor Author

Good grief that's a lot of files changed!! 290!! 😮

The main changes are these:

  • Moved horizon's input /openapi directory into /openapi/horizon
  • Moved horizon's output /api directory into /api/horizon
  • Moved AP's output /ap_api directory into /api/anchor-platform
  • Modified the navbar to only present a single dropdown list containing each API documentation set, rather than individual items all across the top.
  • Changed the openapi plugin configuration to make the /api/* URL behave as a single instance of the plugin-content-docs plugin, instead of using a separate instance for each API
  • Customized the sidebar behavior on /api URLs so that the "category" of API (horizon, anchor platform) doesn't appear unnecessarily in the sidebar but does still show in the breadcrumbs
  • Attempted some nginx redirects from the old output URLs to the new ones.

@ElliotFriend ElliotFriend mentioned this pull request Jun 30, 2023
Signed-off-by: Elliot Voris <[email protected]>
@stellar-jenkins
Copy link

@stellar-jenkins
Copy link

@stellar-jenkins
Copy link

@JakeUrban
Copy link
Contributor

I would recommend "APIs" instead of "API" for the drop-down label, but otherwise LGTM, thanks for taking this on!

@ElliotFriend
Copy link
Contributor Author

I would recommend "APIs" instead of "API" for the drop-down label, but otherwise LGTM, thanks for taking this on!

@JakeUrban Great idea! Pushed that change now. Thank you!

@stellar-jenkins
Copy link

@kalepail
Copy link
Contributor

kalepail commented Jul 6, 2023

This is great and we should merge it!

WITH ONE MAJOR CAVEAT!!!

We need to ensure all broken links are accounted for via the redirects file Given this affects an entire directory you can probably use a few fancy star * wildcards to speed this up. Maybe something in https://github.com/stellar/stellar-docs/blob/main/nginx/nginx.conf vs the redirects.conf. I'll let you poke around a bit as you have a better idea what routes will be breaking here.

Once this is sorted this looks good to merge. Nice work!

@kalepail
Copy link
Contributor

kalepail commented Jul 6, 2023

Ah I see c6b3f83 now. So maybe this has already been dealt with?

@ElliotFriend
Copy link
Contributor Author

Ah I see c6b3f83 now. So maybe this has already been dealt with?

@tyvdh Yes, I believe those redirects will handle everything. As a means of testing them, I put together this script. Here's what it does:

  1. downloads and parses the sitemap.xml for the production docs site.
  2. for each of the URLs, if it includes /api or /ap_api, it changes the domain to the PR preview domain
  3. it requests that preview url, searches through the response and makes sure that an expected redirect took place
  4. it outputs a bunch of crap that might not be useful, but can help to context-ify what's going on.

The only one that didn't respond as "expected" was the /api page, which is a new one that is an "APIs Overview" page.

TL;DR - I checked all the redirects in the sitemap. Things redirect as I was expecting 👍🏻

@kalepail
Copy link
Contributor

kalepail commented Jul 6, 2023

MERGE IT BABY!!!

@ElliotFriend ElliotFriend merged commit 19b1dce into stellar:main Jul 6, 2023
1 check passed
ElliotFriend added a commit to ElliotFriend/stellar-docs that referenced this pull request Jul 6, 2023
While working on stellar#169, I noticed the READ_FIRST doc in the api
directory shows up on the sitemap. This file is intended just for
contributors to better orient themselves with the codebase, and it
shouldn't be added to the sitemap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants