Monday, February 14, 2011

Blogger Blog Post Title Optimization

I've blogged with Blogger for a few years now, and overall it's worked pretty smoothly, but the blog post title can be a bit awkward to work with.

You'll notice that if your post title is particularly long, the resulting URL will get truncated once the post is published to a maximum length of roughly 39 characters. Spaces will be replaced with dashes, stop words like "to", "and", "of" will be filtered, and punctuation will be omitted.

Principles of SEO demand that blog posts are crafted such that search engines will return links to them as relevant hits for a given search. In addition, it is helpful to make it so that the blog post title is similar to the actual URL of the post.

In a Blogger blog, you can optimize your blog post titles by first deciding on a title which is both meaningful and concise. The title should reflect the content of the post, to make it easier for search engines (particularly Google) to categorize what you're blogging about, and decide how high up in the search results to place it. 

For example, if the title of your post is "How To Make Lots Of Money By Blogging On Random Topics" (which is 54 characters without quotes), try to distill the essence of your post into a title which meets or is under the 39 character limit, perhaps "Make Money Blogging Random Topics" (33 characters) or "HowTo Make Money Blogging Randomly" (34 characters). 

Ideally, you want the post title to meet that character limit for Blogger post titles, but sometimes it's difficult, particularly with stop words and spaces eating of valuable post title real estate. 

To mitigate this, you can try the following steps:
  1. Create a blog post with as brief a title as possible.
  2. Publish the post with the brief title.
  3. Immediately after publishing, Edit your post and modify the title to your original, more verbose version.

After doing this, you'll discover that Blogger keeps the concise title's wording in the URL, but in the post itself it will have your verbose title. 

Again, it's probably best that the title be the same in both the URL and the actual post title, but if you just can't do your post justice by pruning it below 39 characters, you can at least ensure that the post URL meets that requirement and yet retains value from an SEO standpoint.





Wednesday, February 9, 2011

Blogger Template Change Kills Google Analytics Script


For some reason, several categories of Google Analytics tracking my Blogger blog stats have flatlined within the last month or so.

I just realized why, I'd made some template changes, including choosing a different template from among Blogger's selections, and this clobbered the analytics script! 

Strangely, even though the tracking code was nonexistent, the Tracking Status indicator in Analytics still says that it's "Receiving Data" even though statistics like New Visits, Avg. Time on Site, and Bounce Rate have been flat.

Anyway, you can visit this Google Analytics help page to find out how to enter the necessary tracking code (the preferred one to use is asynchronous).


Friday, February 4, 2011

Block Reddit Gold on User Pages

Recently, Reddit added a new link beneath users' overview section of their page:
treat yourself to reddit gold

Also if you happen to be checking out another user's profile, you'll see:
buy (another user) a month of reddit gold

I enjoy Reddit a great deal, and I don't block their sponsored ad banners even though I otherwise have AdBlock Plus enabled, but I found this linkage a bit annoying.
ಠ_ಠ

To remove it from your own Reddit user page, you can copy and paste the following Element rule to your AdBlock Plus filter list:
reddit.com##A[href="/gold"]

To prevent the link from appearing on other users' pages, add another rule with the following slightly different syntax:

reddit.com##A[href*="/gold?goldtype=gift"]


Here's a screenshot showing how the rules appear:





Thursday, February 3, 2011

Random Numbers in SQL

I needed a SQL query to insert a range of values randomly into each record of a table variable.

The SELECT statement would use the random number in conjunction with a CASE statement to pick from two different values to insert into a field, in effect tagging records randomly with one value or the other. 

My first attempt involved trying to grab the one's digit of the second of today's date via the getdate() function, and based on whether this value is even or odd, pick one or another of the values to assign to a field for the record I insert.
INSERT INTO @MyTableVariable (MyField)
SELECT

    CASE
        WHEN RIGHT(DATEPART(s, getdate()), 1) IN (0, 2, 4, 6, 8) THEN 32
        WHEN RIGHT(DATEPART(s, getdate()), 1) IN (1, 3, 5, 7, 9) THEN 39
    END AS MyField

FROM dbo.MyTable t

The result wasn't quite what I expected. Instead of one of each inserted value appearing randomly in the resulting table variable for MyField, the same value appeared each and every time.

As it turns out, I didn't realize that in the CASE statement, the seconds portion of the current time, the "seed" if you will, only got set once at the beginning of the SELECT. There is nothing in the statement to prompt the function to update the current time with every iteration, every record examined from MyTable, it only performs a one-off examination of the seconds and goes with that for the rest of the operation.


My solution involved using instead the one's digit of the integer primary key of the source table, like so.
INSERT INTO @MyTableVariable (MyField)
SELECT

    CASE                  
        WHEN RIGHT(t.ID, 1) IN (0, 2, 4, 6, 8) THEN 32        -- Even
        WHEN RIGHT(t.ID, 1) IN (1, 3, 5, 7, 9) THEN 39        -- Odd            
    END AS MyField

FROM dbo.MyTable t

In this case, the subset of data that I'm querying from MyTable is just that, a subset, which means that the primary key (ID) won't be in any particular order; there are plenty of opportunities for the one's digit to be odd or even. This provides a reasonably random sampling of records in the resulting table variable.