-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
API documentation for < 7.0 links broken #44042
Comments
I believe we have two issues with 6.1 docs:
I believe we should fix (2) first, and then regenerate 6.1 and 7.0 documentation. @p8 (2) seems to be happening to all 6.1.x docs and it went unnoticed because they were not using the path prefixes like /cc @zzak |
Thanks @fxn ! |
Turbolinks does not consider relative URLs to assets identical even if the absolute URL would be the same. When visiting /index.html and it has the following css included: <link rel="stylesheet" href="css/panel.css" type="text/css" data-turbolinks-track="reload" /> ... the panel.css would not be seen as identical as when visiting /classes/Array.html with the following css included: <link rel="stylesheet" href="css/panel.css" type="text/css" data-turbolinks-track="reload" /> This results in page reloads and losing the context of the panel when using search. This was previously fixed by making all URLs to assets absolute. But absolute URLs fail when we have multiple versions of the docs in subdirectories like: https://api.rubyonrails.org/v6.1/ See: rails/rails#44042 By removing the `data-turbolinks-track` attribute we can use relative URLs again. This does mean the assets get reloaded everytime we navigate to another page, which required a change to search results. The search results are persisted across navigations using the data-turbolinks-permanent attribute. When we no longer track the assets, the search tree gets rebuild for every navigation. But the URLs to the search results are no longer available in the panel DOM as these are stored in jQuery data attributes. jQuery does not persist this data when navigating to another page: The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery). https://api.jquery.com/data/#data1 By storing the path in a HTML data-attribute it starts working again.
Turbolinks does not consider relative URLs to assets identical even if the absolute URL would be the same. For example when visiting /index.html and it has the following css link: <link rel="stylesheet" href="css/panel.css" type="text/css" data-turbolinks-track="reload" /> ... the panel.css would not be seen as identical as when visiting /classes/Array.html with the following css link: <link rel="stylesheet" href="../css/panel.css" type="text/css" data-turbolinks-track="reload" /> This results in page reloads and losing the context of the panel when using search. This was previously fixed by making all URLs to assets absolute. But absolute URLs fail when we have multiple versions of the docs in subdirectories like: https://api.rubyonrails.org/v6.1/ See: rails/rails#44042 Removing the data-turbolinks-track attribute -------------------------------------------- By removing the `data-turbolinks-track` attribute we can use relative URLs again. This does mean the assets get reloaded everytime we navigate to another page, which required a change to search results. Fixing the search results URLs ------------------------------ The search results are persisted across navigations using the data-turbolinks-permanent attribute. When we no longer track the assets, the search tree gets rebuild for every navigation. But the URLs to the search results are no longer available in the panel DOM as these are stored in jQuery data attributes. jQuery does not persist this data when navigating to another page: The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery). https://api.jquery.com/data/#data1 By storing the path in a HTML data-attribute it starts working again. Updating the rel_prefix ----------------------- When we use relative URLs the rel_prefix will change when we navigate to page that is on another level. For example navigating from `/classes/ActiveRecord.html` to `/classes/ActiveRecord/Attributes/ClassMethods.html` changes the prefix from `../` to `../../../`. If the prefix can change on every navigation, the prefix needs to be loaded from the meta tag everytime.
Thanks @p8 for looking into this 🙇 |
Thanks @zzak! https://github.com/zzak/sdoc/pull/176 should fix this. |
With the migration to a frameless layout, the URLs to assets were made absolute instead of relative because of Turbolinks asset tracking. But absolute URLs fail when we have multiple versions of the docs in subdirectories like: https://api.rubyonrails.org/v6.1/ See: rails/rails#44042 Turbolinks tracking requires absolute URLs ------------------------------------------- Turbolinks does not consider relative URLs to assets identical when tracking assets for reload, even if the absolute URL would be the same. For example when visiting /index.html, in the following css link: <link rel="stylesheet" href="css/panel.css" type="text/css" data-turbolinks-track="reload" /> ... the panel.css would not be seen as identical as when visiting /classes/Array.html with the following css link: <link rel="stylesheet" href="../css/panel.css" type="text/css" data-turbolinks-track="reload" /> This results in page reloads as Turbolinks wants to make sure it has all the latests assets loaded. With a page reload we lose the context of the panel when using search. Instead of using absolute URLs another solution would be to remove the `data-turbolinks-track` attribute. Removing the data-turbolinks-track attribute --------------------------------------------- By removing the `data-turbolinks-track` attribute we can use relative URLs again. In this case Turbolinks just reloads the assets everytime we navigate to another page. Reloading assets has a small performance cost, but this seems barely noticable. It also requires a change to search results. Fixing the search results URLs ------------------------------ The search results are persisted across navigations using the `data-turbolinks-permanent` attribute. When we no longer track the assets, the search tree gets rebuild for every navigation. But the URLs to the search results are no longer available in the panel DOM as these are stored in jQuery data attributes. jQuery does not persist this data when navigating to another page: The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery). https://api.jquery.com/data/#data1 By storing the path in a HTML data-attribute it starts working again. Updating the rel_prefix ----------------------- When we use relative URLs the rel_prefix will change when we navigate to a page that is on another level. For example, navigating from `/classes/ActiveRecord.html` to `/classes/ActiveRecord/Attributes/ClassMethods.html` changes the prefix from `../` to `../../../`. If the prefix can change on every navigation, the prefix needs to be loaded from the meta tag everytime, instead of on the first initialization only.
With the migration to a frameless layout, the URLs to assets were made absolute instead of relative because of Turbolinks asset tracking. But absolute URLs fail when we have multiple versions of the docs in subdirectories like: https://api.rubyonrails.org/v6.1/ See: rails/rails#44042 Turbolinks tracking requires absolute URLs ------------------------------------------- Turbolinks does not consider relative URLs to assets identical when tracking assets for reload, even if the absolute URL would be the same. For example when visiting /index.html, in the following css link: <link rel="stylesheet" href="css/panel.css" type="text/css" data-turbolinks-track="reload" /> ... the panel.css would not be seen as identical as when visiting /classes/Array.html with the following css link: <link rel="stylesheet" href="../css/panel.css" type="text/css" data-turbolinks-track="reload" /> This results in page reloads as Turbolinks wants to make sure it has all the latests assets loaded. With a page reload we lose the context of the panel when using search. Instead of using absolute URLs another solution would be to remove the `data-turbolinks-track` attribute. Removing the data-turbolinks-track attribute --------------------------------------------- By removing the `data-turbolinks-track` attribute we can use relative URLs again. In this case Turbolinks just reloads the assets everytime we navigate to another page. Reloading assets has a small performance cost, but this seems barely noticable. It also requires a change to search results. Fixing the search results URLs ------------------------------ The search results are persisted across navigations using the `data-turbolinks-permanent` attribute. When we no longer track the assets, the search tree gets rebuild for every navigation. But the URLs to the search results are no longer available in the panel DOM as these are stored in jQuery data attributes. jQuery does not persist this data when navigating to another page: The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery). https://api.jquery.com/data/#data1 By storing the path in a HTML data-attribute it starts working again. Updating the rel_prefix ----------------------- When we use relative URLs the rel_prefix will change when we navigate to a page that is on another level. For example, navigating from `/classes/ActiveRecord.html` to `/classes/ActiveRecord/Attributes/ClassMethods.html` changes the prefix from `../` to `../../../`. If the prefix can change on every navigation, the prefix needs to be loaded from the meta tag everytime, instead of on the first initialization only.
With the migration to a frameless layout, the URLs to assets were made absolute instead of relative because of Turbolinks asset tracking. But absolute URLs fail when we have multiple versions of the docs in subdirectories like: https://api.rubyonrails.org/v6.1/ See: rails/rails#44042 Turbolinks tracking requires absolute URLs ------------------------------------------- Turbolinks does not consider relative URLs to assets identical when tracking assets for reload, even if the absolute URL would be the same. For example when visiting /index.html, in the following css link: <link rel="stylesheet" href="css/panel.css" type="text/css" data-turbolinks-track="reload" /> ... the panel.css would not be seen as identical as when visiting /classes/Array.html with the following css link: <link rel="stylesheet" href="../css/panel.css" type="text/css" data-turbolinks-track="reload" /> This results in page reloads as Turbolinks wants to make sure it has all the latests assets loaded. With a page reload we lose the context of the panel when using search. Instead of using absolute URLs another solution would be to remove the `data-turbolinks-track` attribute. Removing the data-turbolinks-track attribute --------------------------------------------- By removing the `data-turbolinks-track` attribute we can use relative URLs again. In this case Turbolinks just reloads the assets everytime we navigate to another page. Reloading assets has a small performance cost, but this seems barely noticable. It also requires a change to search results. Fixing the search results URLs ------------------------------ The search results are persisted across navigations using the `data-turbolinks-permanent` attribute. When we no longer track the assets, the search tree gets rebuild for every navigation. But the URLs to the search results are no longer available in the panel DOM as these are stored in jQuery data attributes. jQuery does not persist this data when navigating to another page: The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery). https://api.jquery.com/data/#data1 By storing the path in a HTML data-attribute it starts working again. Updating the rel_prefix ----------------------- When we use relative URLs the rel_prefix will change when we navigate to a page that is on another level. For example, navigating from `/classes/ActiveRecord.html` to `/classes/ActiveRecord/Attributes/ClassMethods.html` changes the prefix from `../` to `../../../`. If the prefix can change on every navigation, the prefix needs to be loaded from the meta tag everytime, instead of on the first initialization only.
With the migration to a frameless layout, the URLs to assets were made absolute instead of relative because of Turbolinks asset tracking. But absolute URLs fail when we have multiple versions of the docs in subdirectories like: https://api.rubyonrails.org/v6.1/ See: rails/rails#44042 Turbolinks tracking requires absolute URLs ------------------------------------------- Turbolinks does not consider relative URLs to assets identical when tracking assets for reload, even if the absolute URL would be the same. For example when visiting /index.html, in the following css link: <link rel="stylesheet" href="css/panel.css" type="text/css" data-turbolinks-track="reload" /> ... the panel.css would not be seen as identical as when visiting /classes/Array.html with the following css link: <link rel="stylesheet" href="../css/panel.css" type="text/css" data-turbolinks-track="reload" /> This results in page reloads as Turbolinks wants to make sure it has all the latests assets loaded. With a page reload we lose the context of the panel when using search. Instead of using absolute URLs another solution would be to remove the `data-turbolinks-track` attribute. Removing the data-turbolinks-track attribute --------------------------------------------- By removing the `data-turbolinks-track` attribute we can use relative URLs again. In this case Turbolinks just reloads the assets everytime we navigate to another page. Reloading assets has a small performance cost, but this seems barely noticable. It also requires a change to search results. Fixing the search results URLs ------------------------------ The search results are persisted across navigations using the `data-turbolinks-permanent` attribute. When we no longer track the assets, the search tree gets rebuild for every navigation. But the URLs to the search results are no longer available in the panel DOM as these are stored in jQuery data attributes. jQuery does not persist this data when navigating to another page: The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery). https://api.jquery.com/data/#data1 By storing the path in a HTML data-attribute it starts working again. Updating the rel_prefix ----------------------- When we use relative URLs the rel_prefix will change when we navigate to a page that is on another level. For example, navigating from `/classes/ActiveRecord.html` to `/classes/ActiveRecord/Attributes/ClassMethods.html` changes the prefix from `../` to `../../../`. If the prefix can change on every navigation, the prefix needs to be loaded from the meta tag everytime, instead of on the first initialization only.
With the migration of SDoc to a frameless layout, the URLs to assets were made absolute instead of relative because of Turbolinks asset tracking. But absolute URLs fail when we have multiple versions of the docs in subdirectories like: https://api.rubyonrails.org/v6.1/ This version of sdoc restores relative URLs by disabling the Turbolinks asset tracking. Fixes rails#44042
I have regenerated the APIs for all |
Thanks! |
And now all |
This issue solves only half of #43955. As written there, this still won't work:
The generated link seems to be wrong, and should be pointing to N.B.: On https://api.rubyonrails.org, the same link points to |
I copied this over from the rails discussion board to here:
https://discuss.rubyonrails.org/t/api-documentation-broken-for-7-0-0-versions/79574
Steps to reproduce
AbstractController
Expected behavior
Correct documentation page being displayed:
https://api.rubyonrails.org/v6.1.4/classes/AbstractController.html
Actual behavior
Redirect to the wrong URL which is also a 404 page:
https://edgeapi.rubyonrails.org/undefinedclasses/AbstractController.html
System configuration
Rails version: N/A
Ruby version: N/A
The text was updated successfully, but these errors were encountered: