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

Previous Releases link broken for ecosystem projects #235

Closed
coruscating opened this issue Mar 29, 2023 · 9 comments · Fixed by #267
Closed

Previous Releases link broken for ecosystem projects #235

coruscating opened this issue Mar 29, 2023 · 9 comments · Fixed by #267
Assignees
Milestone

Comments

@coruscating
Copy link
Collaborator

The Qiskit Experiments 0.5 docs have just been published, and the Previous Releases links on the sidebar are broken because they're hard coded to /documentation/stable/{{ version }}/index.html:

<div class="sidebar-l2"><a href="/documentation/stable/{{ version }}/index.html">{{ version }}</a></div>

The Qiskit Experiment stable link is at /documentation/experiments/stable/{{ version }}/index.html, so this doesn't work. I would think the easiest solution is adding another html_context variable for the path and letting users customize that in conf.py.

@coruscating
Copy link
Collaborator Author

Also, since ecosystem documentation is deploying to both /documentation and /ecosystem after Qiskit/qiskit.org#3038, the link has to be correct for each site, so maybe the solution mentioned above isn't going to work.

@Eric-Arellano
Copy link
Collaborator

@1ucian0 suggestions for how we should approach this?

@coruscating
Copy link
Collaborator Author

For the docs at the root path, whether it's /documentation or /ecosystem, changing the link to the relative path ./stable/{{ version }}/index.html should work. However, that breaks for the links in the docs for previous versions since it will try to go to /stable/{{ version }}/stable/{{ version }}/index.html. Maybe the links in previous versions can be built differently?

@1ucian0
Copy link
Member

1ucian0 commented Mar 31, 2023

Hmm... my idea of deploy in /documentation and in /providers seems that is not working. I'll take a look.

@Eric-Arellano Eric-Arellano removed this from the Qiskit Sphinx Theme v1.11.0 milestone Apr 3, 2023
@Eric-Arellano Eric-Arellano changed the title Previous Releases link broken Previous Releases link broken due to ecosystem migration Apr 3, 2023
@Eric-Arellano Eric-Arellano added this to the Theme v1.11.0 milestone Apr 11, 2023
@1ucian0
Copy link
Member

1ucian0 commented Apr 12, 2023

I think the solution is to avoid hardcoding the root directory in the template. Probably using something like pathto or root_doc.

@Eric-Arellano Eric-Arellano changed the title Previous Releases link broken due to ecosystem migration Previous Releases link broken for ecosystem projects Apr 12, 2023
@coruscating
Copy link
Collaborator Author

This is not an /ecosystem specific problem so maybe the issue title should be updated. I tested with pathto and root_doc but they only generate relative paths, and I don't see how they solve our problem after #259, which is:

On https://qiskit.org/documentation/experiments, the link is ./stable/0.5, which goes to https://qiskit.org/documentation/experiments/stable/0.5. This works.

On https://qiskit.org/documentation/experiments/stable/0.5, the link is still ./stable/0.5, which goes to https://qiskit.org/documentation/experiments/stable/0.5/stable/0.5. This doesn't work. The sphinx build itself has no idea that we're at a different root URL. If anything, we need a way to get the actual URL in jinja and change the link based on it. Or we have to build previous release sites differently.

@Eric-Arellano
Copy link
Collaborator

Eric-Arellano commented Apr 12, 2023

To summarize the above discussion:

Below are the places where the previous version URL can be clicked from. We need to make sure the URL works from each of these locations.

Terra:

  • documentation/
  • documentation/stable/0.5/index.html

Ecosystem, old scheme:

  • documentation/experiments/
  • documentation/experiments/stable/0.5/index.html

Ecosystem, new scheme:

  • ecosystem/nature/
  • ecosystem/nature/stable/0.5/index.html

Right now, we hardcode to /documentation/stable/<version>/index.html. That correctly handles both URL schemes for Terra. But not the ecosystem.

#259 will fix for all 3 scenarios the link from home, e.g. documentation/. But it will break the link if you are already on /stable/, e.g. /documentation/stable/0.41/index.html would now become /documentation/stable/0.41/index.html/documentation/stable/0.39/index.html.

If anything, we need a way to get the actual URL in jinja and change the link based on it. Or we have to build previous release sites differently.

I agree. We can do this via JavaScript looking at window.location.href. I'll work on this today.

@Eric-Arellano
Copy link
Collaborator

@1ucian0 now that we have redirects of documentation/<proj> to ecosystem/<proj>, I'm not sure how this updates what I say right above?

Are you publishing old builds of the docs under ecosystem/, or only the most recent builds? Although, I think maybe no ecosystem projects have been using the previous versions feature so this is irrelevant?

Are we ever publishing anymore to documentation/?

@1ucian0
Copy link
Member

1ucian0 commented Apr 22, 2023

I think what you have above still applies. Currently, old versions of qiskit-experiments are deployed in https://qiskit.org/ecosystem/experiments/stable/<version>/:

https://github.com/Qiskit/qiskit-experiments/blob/5d840c89e7b008644a0b46c86db5afbc05cab4e8/tools/deploy_documentation.sh#L39

Because the CDN redirect, /documentation/experiments/ and /ecosystem/experiments/ should behave similarly:

[/^qiskit\.org\/documentation\/experiments\/(.*)/, 'qiskit.org/ecosystem/experiments/$1'],

Are you publishing old builds of the docs under ecosystem/, or only the most recent builds?

Depends a lot on the project. Not every project keeps old build. The documentation-ecosysytem change should not change what projects are doing.

Right now, we hardcode to /documentation/stable//index.html. That correctly handles both URL schemes for Terra. But not the ecosystem.

That's right.

1ucian0 pushed a commit that referenced this issue May 4, 2023
Closes #235. As
summarized in
#235 (comment),
we were only handling Terra properly.

I used test driven development to ensure I handled all the edge cases.

## Leverages ecosystem redirects

We are now successfully redirecting ecosystem projects, e.g.
`documentation/experiments/` to `ecosystem/experiments`. That simplifies
the edge cases we need to handle: we only need to handle Terra
(`documentation/`) and Ecosystem (`ecosystem/<project>`).

## Adds `utils.js` file

Having a dedicated JavaScript file for our logic will make it easier to
find all our custom logic. It also allows us to test the contents with
Jest.
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 a pull request may close this issue.

3 participants