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

Issues with clean urls vs cleanest urls, should get instant replaceState #108

Open
3 tasks
brendanheywood opened this issue Jul 27, 2017 · 2 comments
Open
3 tasks
Labels

Comments

@brendanheywood
Copy link
Owner

So currently the existing logic for clean urls is they are clean, or they are not.

But we now have the situtions there where are multiple verisons of a url all of which work, but one is considered cleaner, or canonical. ie:

Module id based url:
https://u.catalyst-au.net/course/COMP100/module-1/16-test-unboxpage

Custom stub based url:
https://u.catalyst-au.net/course/COMP100/module-1/test/etst

On unclean pages we detect that a page could be clean, and then use html5 replace state to fix the url. We also need to do it this case.

  • detect if current clean url is different to if we re-cleaned it and fix up the replaceState
  • always serve a canonical url even when cleaned, but make sure it's to the real good cleaned url
  • also fix the hash tag code so that it always relative to this page and not what we think the page should be (and ideally make that code look it up at run time not at render time??)
if (element.getAttribute('href').charAt(0) == '#') {
--
  | element.href = 'https://u-cqu-mba.catalyst-au.net/course/COMP100/module-1/test/etst' + element.getAttribute('href');
  | }
@brendanheywood brendanheywood changed the title Issues with cleanerer urls vs just clean urls, should get instant replaceState Issues with clean urls vs cleanest urls, should get instant replaceState Jul 27, 2017
@roperto
Copy link
Collaborator

roperto commented Jul 28, 2017

@brendanheywood

When using a format that renders the default module subpath, it will try to first use the custom path then the id-name version if no custom path. From my understanding, we don't have two URLs and one of them is "better" but we have only the cleaned and uncleaned.

I probably misunderstood something, but I need an example of what is wrong or could be improved.

I understand the second part of the replacestate, where we are losing the anchor # part of the URL that needs to be fixed, but I don't really see how an URL coming through the router (not legacy URL) can have a better version, at least not at this stage.

For the legacy ones, we will apply the uncleaning and it will give the cleaned version (which is already doing) -- it does not give a list of options where we have to choose the best one.

Again, I know I am probably misunderstanding something so let's talk about that when you have some time.

@brendanheywood
Copy link
Owner Author

Pretty sure we covered this 1-1 but re-iterating:

if you have an activity with no custom slug, then it has url A. If you then add a custom stub it has url B.

B is 'cleaner' than A and should be considered canonical. But A should still continue to work.

  • If you view A then in it's header is should serve a canonical url to B in it's head tag
  • If you view A then it should also do an immediate replacestate to B
  • If you view A then internal page hash links should work without a page load
  • If you view B then in it's header is should serve a canonical url to itself (B) in it's head tag
  • If you view B then internal page hash links should work without a page load

Short story is that any cleanable page (and only cleanable pages) should always server a canonical url

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