Created
September 7, 2014 13:39
-
-
Save drouillard/fbd62db65fea5ea0ca73 to your computer and use it in GitHub Desktop.
Nationbuilder - Handle Uppercase letters in Slugs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nationbuilder does not accept slugs that have uppercase letters. If they are used then a the 404 page for the theme used is shown | |
E.G. This link will work | |
www.mysite.nationbuilder.com/valid | |
This link will **not** work | |
www.mysite.nationbuilder.com/Valid | |
(notice uppercase 'V') | |
The way to get around this is to use a client side redirect is uppercase letters are present in the slug, which is what the attached gist does. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Content for page_not_found / 404 page --> | |
<div class="padcontainer" id='message' style='display:none'> | |
The page you were looking for was not found. | |
</div> | |
<script type="text/javascript"> | |
if(/[A-Z]/.test(window.location.href)) { | |
window.location = window.location.href.toLowerCase(); | |
} | |
else{ | |
$('#message').show(); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment