Skip to content

Instantly share code, notes, and snippets.

@klaasnotfound
Last active April 7, 2019 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klaasnotfound/22efc8afd773588acc65996b343ce602 to your computer and use it in GitHub Desktop.
Save klaasnotfound/22efc8afd773588acc65996b343ce602 to your computer and use it in GitHub Desktop.
A minimal example for a base.html file that can be used with the modified Jekyll i18n plugin and performs a browser language-based redirect.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Simple Redirect Page</title>
</head>
<body>
<script>
var lang = navigator.language || navigator.userLanguage;
if (lang.indexOf('de') == 0)
window.location = '/de/';
// Other languages here
else
// Default to English
window.location = '/en/';
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment