Last active
March 26, 2017 23:09
-
-
Save mayurah/4a0861b6d68b335d970e01e9fff4bd6e to your computer and use it in GitHub Desktop.
blogspot to shopify redirect (javascript way)
This file contains hidden or 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
// Tested on friend Dr Raley's website | |
// Old (Google Blogger / Blogspot): http://cecileraleydesigns.blogspot.com/ | |
// New (Shopify): https://www.cecileraleydesigns.com/blogs/cecile-raley-designs/ | |
// Note: This simple JS only redirects blog (containing month/day) and not home page, or dedicated pages. | |
var newBlog = "https://www.your-website.com/blogs/blog-name/"; | |
var current_blogspot_slug = document.baseURI.split("/")[5].split(".")[0]; | |
if( document.baseURI.split("/")[3] % 1 === 0 ) if( document.baseURI.split("/")[4] % 1 === 0 ) { | |
console.log("true - let's redirect to new home"); | |
window.location.href=newBlog+current_blogspot_slug; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment