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

decodeURI() titles #8

Closed
kaysond opened this issue Feb 5, 2018 · 3 comments
Closed

decodeURI() titles #8

kaysond opened this issue Feb 5, 2018 · 3 comments

Comments

@kaysond
Copy link

kaysond commented Feb 5, 2018

If window.location.pathname has URI-encoded components (like %20 for spaces), then the title comes out quite ugly (and titleize()) doesn't work as intended. Using decodeURI(window.location.pathname.replace(/\/$/g, '')) solves it.

Personally, I got rid of the toLowerCase() titleize() altogether.

@Vestride
Copy link
Owner

Vestride commented Feb 5, 2018

Thanks for pointing this out.

@kaysond
Copy link
Author

kaysond commented Feb 5, 2018

FWIW I think you should also get rid of the toLowerCase(). I scanned through a bunch of indexes of media folders, and it looks funny when the function uncapitalizes something because it's in the middle of a word or next to a non space character. If you remove the lower case, it will still capitalize everything next to a space hyphen underscore, etc. but will leave existing capitals untouched.

Not sure what your intended behavior/typical scenario is. It's not hard for users to change, in any case.

@kaysond
Copy link
Author

kaysond commented Feb 5, 2018

Btw thanks for putting this together I'd been looking for a responsive index for years

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

No branches or pull requests

2 participants