visionmedia / page.js

Micro client-side router inspired by the Express router
http://visionmedia.github.com/page.js
7.67k stars 687 forks source link

Added option to disable baseUrl in pathname #418

Open clayrisser opened 7 years ago

clayrisser commented 7 years ago

I think it's terrible to force explicitly mentioning the baseUrl in every href. I propose adding the option baseUrlInPathname. I set its default value to true, so it won't break anything.

clayrisser commented 7 years ago

Reference issue #234.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 89.209% when pulling 0b541336374e7686d17244c2288633979d0bf0a4 on jamrizzi:master into 1034c8cbed600ea7da378a73716c885227c03270 on visionmedia:master.

matthewp commented 6 years ago

Hey @jamrizzi, I don't totally understand the issue you're fixing. Can you give some code examples of the undesirable behavior?

clayrisser commented 6 years ago

https://github.com/thingdown/blogdown/commit/6ebd304820c3ce31fb6bd2c7f3ef1c41ae666b0b

matthewp commented 6 years ago

I was hoping for a small code example. I think what you are saying is that you expect to be able to do:

page.base('/some/base');

page('/foo', function(){

});

And then have links like:

<a href="/foo">Hello world</a>

Is this correct? If so I agree that this shouldn't be needed.

clayrisser commented 6 years ago

Correct

clayrisser commented 6 years ago

There are cases where it is needed. Specifically, websites where the root is not directly on a domain, but several directories in.

clayrisser commented 6 years ago

For example, github pages