Tuesday, July 29, 2014

How to change internal links when you chance your blog's web-address

This article is about how to change internal cross-reference links in your blog, if you change your blog's URL or web-address.

Blog Name vs Blog Address

Your blog has two "names".

The blog title is what you type into the Title field when you create a new blog.   It is displayed in your header (unless you've replaced it with a picture), and in the title-bar of the browser window when someone reads your blog.  It does not need to be unique:  you can make a blog with the same name that anyone else has already used.

The web-address, also called the URL or just address is quite different. You select in the Address field when you create a new blog - but it's not just a matter of typing in what you want.   Web-addresses must be unique, so as you type in a possible URL Blogger says "checking availability" - and if someone else already has what you have entered, it says
Sorry, this blog address is not available.
and you have to keep trying until you find a blogspot URL which is not already taken.

Usually the blog-title and blog web-address are very closely related.   For example, the name of this blog is Blogger-hints-and-tips, and the web-address is www.Blogger-hints-and-tips.blogspot.com.  And they may be even more closely related if you have a custom domain, eg
Title / Name: Rustling.org
Web-address: www.Rustling.org

In this case, I've made the blog-name slightly geeky (with a .org on the end) to make it more memorable.

Changing title vs changing address

You can change the blog-name at any time, using the Settings > Basic > Title tab.   Doing this has no effect on any links in you posts or widgets.  (Although it may confuse people who find your blog by searching for the name rather than for the web-address - which is a good reason to encourage them to become subscribers, instead.)

You can change the blog-address using the Settings > Basic > Publishing tab.   Just like the original URL, whatever you change it to has to be unique, ie not one that anyone else has used.

Sidenote:  If you want to use an address that a different Google account, eg a friend, used to have, then you need to transfer the ownership:  having the previous owner delete a blog is not enough to release the blogspot address for someone else to use.

But if you change the blog-address, then any existing links to your blog become dead, ie they stop working and anyone who tried to follow them gets a 404 error. This applies to both external links (eg on other people's blogrolls or Google's search index) and to internal links (when you have a link to one post inside another post or gadget)

What happens if change your blog's web-address

If you change your blog's web-address, then Blogger changes the links in your Pages gadget that point to your pages.

But Blogger will not change any other internal links in your blog. This includes:
  • Links in your Pages gadget that were added as External web-addresses - even if those web-addresses are posts or pages in your blog.
  • Links in one post that point to another one (called cross-links)
  • Links in your other gadgets - including LinksList gadgets and HTML/Javascript ones.

Therefore all these links will break if you change your blog's web-address.    If someone tries to follow one of these links they get a message like this:
Blog has been removed
Sorry, the blog at yourOldAddress.blogspot.com has been removed. This address is not available for new blogs.

However gadgets which calculate links (eg Blogger's Popular Posts, or the third-party widgets like LinkWithin) do keep working, because the they get the current link of your posts when they need them rather than keeping a stored copy.   (That said, ones that rely on your RSS feed to for information may stop working correctly.)

And of course Blogger will not change links to your blog that are in other people's blog-posts or gadgets.

This is why it's A Very Good Idea to get your blog name - including a custom domain if you want one - right before you start writing posts with cross-links.

Relative addressing and the Blogger Post Editor

Some people have asked if it is possible to internal links (ie links from one post to another) as
instead of

So that if they change the blog-address, the links will still work.

However Blogger's Post Edit does not support relative addressing, so this isn't possible: If you enter a link as

 then when you you publish the post it is changed to     (if you add the link in compose mode), or
http://yourWebAddress/12/2013/how_to_do.html     (if you add the link in HTML mode).

(I think this is a change from Blogger's previous behaviour from when I last investigated this issue:  previously it changed the links to something like http:/blogger.com/12/2013/how_to_do.html - and of course this doesn't work either.)

How to change internal links in your posts when you change blog-address

Unfortunately Blogger doesn't provide any tool to automatically update all internal links in your posts when you change blog-address.

Instead, you have to manually:
  • Edit each post
  • Look at it in HTML mode and 
  • Find-and-replace any links. 

The only slight automation is that you can do the find-and-replace by copying the entire post-contents to a text-editor like Notepad, using the Replace tool there, and then copying the entire post contents back to the post editor.

Some people have asked if it's possible to do this by:
  • Exporting all your posts using the Export Blog tool on the Settings > Other > Export Blog option
  • Opening the exported file in a text editor, and changing all the links with the Find-and-Replace tool.
  • Deleting all the posts from your blog
  • Importing from your export file, after it's been edited.

However this won't work because Blogger remembers the address of each individual post, even after they're deleted.   It won't give the same URL to another post, ever.  Instead, it puts some numbers on the end, to make the URL unique. For example, when I tested this:

You could use the custom-re-directs feature to repoint each old post-url to the new one, it would probably be quicker overall to simply edit each post.

Related Articles:

How to edit a post you have already published

Adding a Pages gadget to your blog

Setting up a custom domain for Blogger

Giving another Blogger account access to an address that you own

Share this Article


HTML link code:

BB (forum) link code:

Subscribe to Blogger-hints-and-tips

FeedBurner will send a confirmation message. Click the verify link in it to start your subscription.

Follow Me on Pinterest Subscribe to Blogger-HAT on Google + RSS subscription icon Follow BloggerHAT on Twitter

No comments:

Post a Comment