Skip to content

Docs: Redirects for subpages implemented #10948

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

Closed
wants to merge 2 commits into from
Closed

Docs: Redirects for subpages implemented #10948

wants to merge 2 commits into from

Conversation

jostschmithals
Copy link
Contributor

@jostschmithals jostschmithals commented Mar 7, 2017

Related to #10937

Pages reached from outside (for instance via google) are now correctly displayed (with navigation panel and working links),

by redirecting pages with URLs such as the following ones …

  1. ... docs/api/objects/SkinnedMesh.html
  2. ... docs/manual/introduction/Detecting-WebGL-and-browser-compatibility.html
  3. ... docs/api/core/BufferGeometry.html
  4. ... docs/manual/introduction/Animation-system.html
  5. ... docs/api/renderers/webgl/plugins/LensFlarePlugin.html
  6. ... docs/examples/loaders/OBJLoader.html
  7. ... docs/api/animation/tracks/QuaternionKeyframeTrack.html

… to their corresponding iframe-URLs (using docs/list.js for mapping):

  1. ... docs/#Reference/Objects/SkinnedMesh
  2. ... docs/#Manual/Getting_Started/Detecting_WebGL_and_browser_compatibility
  3. ... docs/#Reference/Core/BufferGeometry
  4. ... docs/#Manual/Next_Steps/Animation_System
  5. ... docs/#Developer_Reference/WebGLRenderer.Plugins/LensFlarePlugin
  6. ... docs/#Examples/Loaders/OBJLoader
  7. ... docs/#Reference/Animation.Tracks/QuaternionKeyframeTrack

docs/page.js Outdated

if ( page[ 1 ] === section + '/' + path ) {

redirectUrl = 'index.html#'
Copy link
Collaborator

Choose a reason for hiding this comment

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

redirectUrl = 'index.html#'

To be consistent with links from the sidebar this should just be

redirectUrl = '#'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course index.html is redundant. Seems that I didn’t see the forest for the trees ;-)

Thanks!

@jostschmithals jostschmithals mentioned this pull request Mar 21, 2017
13 tasks
@mrdoob
Copy link
Owner

mrdoob commented Mar 21, 2017

@mrdoob
Copy link
Owner

mrdoob commented Mar 21, 2017

Rather than redirecting... How about changing the links so when you click them you end up in the docs?

@jostschmithals
Copy link
Contributor Author

I am not sure whether I understand you correctly(?)

Putting myself in the situation of a programmer searching for “three.js SkinnedMesh” on google I would expect, that a link which leads to a subpage of threejs.org (in this case https://threejs.org/docs/api/objects/SkinnedMesh.html) would work correctly (which is currently not the case).

But I would not have the expectation that a link from forked repositories would automagically work in the same way. So this was not the use case I had in mind.

@mrdoob
Copy link
Owner

mrdoob commented Mar 21, 2017

But I would not have the expectation that a link from forked repositories would automagically work in the same way. So this was not the use case I had in mind.

No no...

Say that the user ends up in https://threejs.org/docs/api/objects/SkinnedMesh.html. What I'm saying is to change the code so when the user clicks on 'Object3D` on the top-left, the link goes to https://threejs.org/docs/#Reference/Core/Object3D.

@jostschmithals
Copy link
Contributor Author

jostschmithals commented Mar 22, 2017

Thanks for your clarification. I hope that I now understand the direction in which you wanted to point me (but I am not yet sure).

Your suggestion is to make no redirection at all, but to change the links on the subpages level only?

1. Version with redirection

Say that the user ends up in https://threejs.org/docs/api/objects/SkinnedMesh.html.

With my implementation the user should never “end up” in https://threejs.org/docs/api/objects/SkinnedMesh.html, since he is immediately directed to https://threejs.org/docs/#Reference/Objects/SkinnedMesh.

In this way all links (and the “Edit”-button) should work correctly, and the additional advantage would be that coming from google&Co. the navigation panel is always immediately available (collapsed to a hamburger button on small devices) – I guess this is the “normal” behavior a user (who doesn’t need to know about the internal iframes structure) would expect from a modern website.

Since the forwarding to the higher level is done with location.replace() and not with location.href= the browser’s back button should work as expected, too.

  • Is there a disadvantage/problem with this forwarding solution I have not yet realized?

2. Version without redirection

If we would go without this redirection and “only” fix the links (wouldn’t that be more complicated anyway?), the user would miss the full possibilities of the navigation panel, until he has the idea to click on a link that takes him away from this particular subpage (iframe). This would remind me in an unpleasant way of old fashion HTML frame architectures.

  • I don’t know, what could be the advantage of doing it without forwarding to the higher level?

@mrdoob
Copy link
Owner

mrdoob commented Mar 22, 2017

I think my worry is that we're dragging a design mistake...

Currently we have:

https://threejs.org/docs/api/objects/SkinnedMesh.html
https://threejs.org/docs/#Reference/Objects/SkinnedMesh

I think this should just be:

https://threejs.org/docs/api/objects/SkinnedMesh.html
https://threejs.org/docs/#api/objects/SkinnedMesh

This way the redirection code will be much simpler.

@jostschmithals
Copy link
Contributor Author

I think this should just be:
https://threejs.org/docs/api/objects/SkinnedMesh.html
https://threejs.org/docs/#api/objects/SkinnedMesh

I absolutely agree.

As far as I can see there are (at least) two problems with the docs which are existing separately (but the final solution of No.1 depends on whether and how No.2 is solved):

  1. The broken links and missing navigation when coming to a subpage from outside.

  2. The two concurrent link structures which made the existing mapping in index.html much more complex than it should/could be (and which are now also complicating the solution of No.1).

Being new to three.js, I thought that there must be some kind of mystic reason for No.2 which my mind couldn’t grasp 😉 ; therefore I didn’t want to change this all at once and focused on an isolated solution for No.1 instead.

@mrdoob If you want, I would close this issue and work on a solution for No.2 first (synchronizing the two structures and cleaning up the existing code in index.html). After this the solution for No.1 would be indeed much simpler.

@looeee Of course I am also very interested in your opinion and advice, since you have broad experience with the docs.

@mrdoob
Copy link
Owner

mrdoob commented Mar 22, 2017

Being new to three.js, I thought that there must be some kind of mystic reason for No.2 which my mind couldn’t grasp 😉 ; therefore I didn’t want to change this all at once and focused on an isolated solution for No.1 instead.

Yep yep! I appreciate that.

@mrdoob If you want, I would close this issue and work on a solution for No.2 first (synchronizing the two structures and cleaning up the existing code in index.html). After this the solution for No.1 would be indeed much simpler.

Yes! That would be great! 👍

@jostschmithals
Copy link
Contributor Author

jostschmithals commented Mar 23, 2017

It seems to be much easier than I thought (no synchronizing of the two present structures needed):

If we simply use in index.html the original urls of the iframe-pages and completely forget the conversion into the second url format, all seems to work perfectly, in and from all directions - without any other changes (besides a very simple redirection from the subpages).

There must have been a reason why this second url track with the complex conversion was invented some centuries ago, but it seems that this reason is no longer existent ;)

But now I would like to take the time to make a thorough refactoring (and simplification) of this index.html first before making a new PR.

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.

3 participants