Skip to content

remove client side URL rewrites #53

@wkeese

Description

@wkeese

If I select 1.4 in the dropdown and bring up dijit/Calendar, then click the Permalink, the URL bar goes to https://dojotoolkit.org/api/?qs=1.4/dijit/Calendar. Happens for 1.3 〜 1.7.

Two issues:

  • Ideally it would be https://dojotoolkit.org/dapi/1.10/dijit/Calendar.html rather than using the URL query string (question mark syntax).
  • The URL switched from referencing dapi to api. I guess that won't be an issue when this is deployed for real, but probably indicates some underlying problem.

This problem is leftover effect from when we were serving pages statically and the rewrite was happening in client-side javascript. By turning off javascript and clicking the Permalink URL (and then view source) I can see:

<script type="text/javascript">
  // If user loads this page directly, redirect to index page, with parameter to initially show tab for this module.
  // If google loads this page directly it will hopefully ignore this script and just index the documentation below.
  // Also, when this page is loaded via XHR this script block should be ignored.
  location = "/api/?qs=1.10/dijit/_OnDijitClickMixin" + location.hash;

</script>

I remember having a perl script that added those <script> blocks but now I can't find the check-in. I don't see those script blocks [anymore] either in https://github.com/wkeese/dojo-api-data/tree/master/1.6/dijit/Calendar, so I'm confused.

There's also this code in app.js:

// rewite the url to the ?qs= parm, meaning all legacy permalinked docs are still loaded via XHR.
// the only other option is dynamically including the html in the template which wouldn't be good for performance
// TODO: the .html extension is an issue, here im stripping it (compared to legacyfilelocation), this is also mirrored in the client JS (and FWIW apache)
res.redirect(301, config.contextPath + '?qs=' + requestedVersion + '/' + modulefile.replace(/\./g, "/"));

A related issue is that after doing the above, the dropdown says 1.10 instead of 1.4, even though the tree is showing 1.4. Selecting 1.10 in the dropdown list manually now has no effect. (But I can get back to the 1.10 tree by selecting 1.9 first, then selecting 1.10).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions