Skip to content

Instantly share code, notes, and snippets.

@drouillard
Created September 7, 2014 13:39
Show Gist options
  • Save drouillard/fbd62db65fea5ea0ca73 to your computer and use it in GitHub Desktop.
Save drouillard/fbd62db65fea5ea0ca73 to your computer and use it in GitHub Desktop.
Nationbuilder - Handle Uppercase letters in Slugs
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.
<!-- 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