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

Switching Cordova Version of an article redirects to the startpage #1278

Open
3 tasks
GitToTheHub opened this issue Dec 19, 2022 · 4 comments
Open
3 tasks
Labels

Comments

@GitToTheHub
Copy link

Bug Report

Problem

When i switch the cordova version for an article, the startpage of the docs are shown.

What is expected to happen?

I should stay in the article, when i switch the cordova version.

What does actually happen?

I'm redirected to the startpage of the docs.

Information

Example:
"Next Steps"-article for cordova version 9:
https://cordova.apache.org/docs/en/9.x/guide/next/

If you switch the cordova version, you always gets redirected to the startpage of the docs: https://cordova.apache.org/docs/en/latest/
no matter which version you are selecting.

The docs exists for the other versions, if manually edit the url:
Version 10: https://cordova.apache.org/docs/en/10.x/guide/next/
Version 11: https://cordova.apache.org/docs/en/11.x/guide/next/
dev:
https://cordova.apache.org/docs/en/dev/guide/next/

Environment, Platform, Device

Smartphone, Android 10, Google Chrome
I think it' s the same problem on a desktop pc.

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@breautek
Copy link
Contributor

breautek commented Jan 6, 2023

I think this is probably intentional. Switching versions via either the banner or the version selector always returns back to the "Home" page of the Documentation. I do understand the annoyance however. I think the primary reason for this behaviour is that it's not easy to know if a particular version of a page exists in another version of the documentation.

@GitToTheHub
Copy link
Author

I saw, that it is not happening on every article. For example the article "Customize Icons". The switching between the versions works here:
Article in Version 9:
https://cordova.apache.org/docs/en/9.x/config_ref/images.html
If I use the switch or click on "Click here for the latest released version.", i stay in the article. But if I'm doing the same for "Next Steps" it's not working, though the other versions exists.

@breautek
Copy link
Contributor

breautek commented Jan 7, 2023

Interesting. I've done a bit further research and found several pages that did properly do a redirect, and some that didn't.

It seems to be powered by

{% comment %}
Get URL for this page in the latest version
{% endcomment %}
{% capture latest_root %}/docs/{{ page.language }}/latest/{% endcapture %}
{% assign latest_url = page.url | replace:VERSION_ROOT,latest_root %}
{% comment %}
If this page doesn't exist, just use root
{% endcomment %}
{% unless ALL_PAGES contains latest_url %}
{% assign latest_url = latest_root %}
{% endunless %}

It produces a link with the same URL but replacing the version with latest in the URL for the link. However, the build process actually builds a list of generated URLs called all-pages, which the above snippet seems to use to decide to fallback to the documentation root/index.

So this indicates that I was in fact wrong and redirecting to the same documentation page of of a different version is the intended behaviour.

It's been awhile since I built locally, but my last build does include some of the URLs that isn't working. Unfortunately I'm not in a position to attempt to build as jekyll seems to depend on Ruby2, which is basically EOL now and Ubuntu 22 doesn't have official support anymore. Trying to install Jekyll on Ruby3 has errors. Thus, I'm unable to get a "modern" all-pages.yml build.

I'll be curious to see if the generated all-pages.yml file contains or is missing some of those URLs that isn't redirecting to the same version, such as /docs/en/latest/guide/platforms/android/index.html. If it's missing that line, then we have to look at why the generated all-pages.yml file is missing that page, otherwise we need to look at why the template seems to think it's missing.

@breautek breautek added the bug label Jan 7, 2023
@GitToTheHub
Copy link
Author

Cool, thank you for your research. I was surprised, that you wrote, you cannot setup a local build environment, because the used technology is too old. So the cordova docs are still build with these old technologies? Is jekyll still under development, or is the last supported version only for Ruby2?

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

No branches or pull requests

2 participants