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

Provider and Runtime show modules as top-level in sidebar #561

Merged
merged 2 commits into from
Jan 3, 2024

Conversation

Eric-Arellano
Copy link
Collaborator

@Eric-Arellano Eric-Arellano commented Dec 29, 2023

Closes #558.

Before:

Screenshot 2023-12-29 at 1 38 50 PM

After:

Screenshot 2023-12-29 at 1 39 08 PM

This new left sidebar layout aligns with Qiskit. The consistency is useful, but also I think this new layout is more functional anyways. It reduces the amount of nesting. It also allows us to collapse the left sidebar by default, which we do in the rest of the docs.

Changes index page

Before, the index page was the description for the code components belonging to the top-level modules qiskit_ibm_provider and qiskit_ibm_runtime, rather than enumerating what all the modules are:

Before:
Screenshot 2023-12-29 at 1 40 19 PM

After:
Screenshot 2023-12-29 at 1 41 30 PM

Note that this index page is not accessible from the left sidebar; it's not clear what we would call it. But you can access it from the top nav-bar:

Screenshot 2023-12-29 at 1 42 13 PM

Metadata

The new index pages have never had metadata. That's because we don't have any technique to determine from Sphinx programatically its metadata because the Sphinx generated HTML page is missing it:

https://github.com/Qiskit/documentation/blob/92b3fa45c10aa917c3fbc7ada861b2db55203902/scripts/lib/sphinx/PythonObjectMeta.ts#L13-L24

This is an instance of #66. I think we need a generic solution to that problem, such as Axel's suggestion to use filenames as a fallback. But, it's important that the metadata is high quality for these two index pages since they are so high-profile.

So, I propose hardcoding the metadata for them. Because there are only two files, I think this approach is acceptable; obviously it wouldn't scale if we were hardcoding dozens of files.

@Eric-Arellano Eric-Arellano changed the title [wip] Provider and Runtime show modules as top-level in sidebar Provider and Runtime show modules as top-level in sidebar Jan 2, 2024
@@ -0,0 +1,66 @@
---
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 used to be /index. It is the API page for the top-level module.

@@ -1,66 +1,16 @@
---
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 used to be ibm-provider.md (with -, not _). The only change we've made is the front matter / metadata.

Comment on lines -22 to -24
"docs/start/__migration-guide-algorithms.md",
"docs/start/__migration-guide-opflow.md",
"docs/start/__migration-guide-qi.md",
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 files don't exist anymore.

Comment on lines -96 to -101
tocOptions: {
collapsed: true,
nestModule(id: string) {
return id.split(".").length > 2;
},
},
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 is now the universal behavior.

@@ -20,7 +20,14 @@ export function addFrontMatter<T extends SphinxToMdResult>(
): void {
for (let result of results) {
let markdown = result.markdown;
if (result.meta.python_api_name) {
if (result.meta.hardcoded_frontmatter) {
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 order of this if matters. If you hardcode the frontmatter, we use that no matter what. That will be important when we fix #66 to add a fallback like using the filename. We want to make sure we still use the hardcoded metadata for these two index files.

test("generate a toc", () => {
const toc = generateToc(pkg, [
{ meta: {}, url: "/docs/runtime" },
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 changed this test to better reflect reality.

`);
});

test("nest modules", () => {
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 test isn't necessary anymore since the nesting behavior is now consistent. The above test should cover this.

@Eric-Arellano Eric-Arellano marked this pull request as ready for review January 2, 2024 17:39
@Eric-Arellano Eric-Arellano requested review from arnaucasau and frankharkins and removed request for arnaucasau January 2, 2024 19:23
Copy link
Collaborator

@arnaucasau arnaucasau left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thank you Eric!

Copy link
Member

@frankharkins frankharkins left a comment

Choose a reason for hiding this comment

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

Thanks!

Will the navbar need updating? Clicking API reference > Qiskit IBM Runtime Client still takes me to "Overview"

@Eric-Arellano
Copy link
Collaborator Author

Will the navbar need updating? Clicking API reference > Qiskit IBM Runtime Client still takes me to "Overview"

Is this the staging preview? That image is super out of date and we've had issues updating it. In production, the URL from the top nav bar is https://docs.quantum.ibm.com/api/qiskit-ibm-runtime and it takes you to the correct /index file.

@Eric-Arellano Eric-Arellano added this pull request to the merge queue Jan 3, 2024
Merged via the queue into main with commit dc6a432 Jan 3, 2024
4 checks passed
@Eric-Arellano Eric-Arellano deleted the EA/runtime-index branch January 3, 2024 16:11
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
Closes Qiskit#558.

Before:

<img width="248" alt="Screenshot 2023-12-29 at 1 38 50 PM"
src="https://github.com/Qiskit/documentation/assets/14852634/299bd13b-e681-4105-93b6-9525312c547a">

After:

<img width="251" alt="Screenshot 2023-12-29 at 1 39 08 PM"
src="https://github.com/Qiskit/documentation/assets/14852634/21c900af-b44c-4c69-9ac5-133bbc251b00">

This new left sidebar layout aligns with Qiskit. The consistency is
useful, but also I think this new layout is more functional anyways. It
reduces the amount of nesting. It also allows us to collapse the left
sidebar by default, which we do in the rest of the docs.

## Changes index page

Before, the index page was the description for the code components
belonging to the top-level modules `qiskit_ibm_provider` and
`qiskit_ibm_runtime`, rather than enumerating what all the modules are:

Before:
<img width="625" alt="Screenshot 2023-12-29 at 1 40 19 PM"
src="https://github.com/Qiskit/documentation/assets/14852634/c2e08d6f-365e-4775-8719-c6aad01cc77a">

After:
<img width="658" alt="Screenshot 2023-12-29 at 1 41 30 PM"
src="https://github.com/Qiskit/documentation/assets/14852634/4a58cdd7-48f3-4e28-a0e4-cb716f095e4e">

Note that this index page is not accessible from the left sidebar; it's
not clear what we would call it. But you can access it from the top
nav-bar:

<img width="234" alt="Screenshot 2023-12-29 at 1 42 13 PM"
src="https://github.com/Qiskit/documentation/assets/14852634/4c9ebdd7-9bf2-45ed-8c3b-b998d319d5ec">

## Metadata

The new index pages have never had metadata. That's because we don't
have any technique to determine from Sphinx programatically its metadata
because the Sphinx generated HTML page is missing it:


https://github.com/Qiskit/documentation/blob/60c836afbf30729fa30a97086b5812b08970ded5/scripts/lib/sphinx/PythonObjectMeta.ts#L13-L24

This is an instance of
Qiskit#66. I think we need a
generic solution to that problem, such as Axel's suggestion to use
filenames as a fallback. But, it's important that the metadata is high
quality for these two index pages since they are so high-profile.

So, I propose hardcoding the metadata for them. Because there are only
two files, I think this approach is acceptable; obviously it wouldn't
scale if we were hardcoding dozens of files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Use correct index page for Runtime and Provider
3 participants