When: Bloger Tips
Showing posts with label Bloger Tips. Show all posts
Showing posts with label Bloger Tips. Show all posts

Monday, December 7, 2009

How do I add Google AdSense to my RSS feed?

While Google is the master of nifty new programs, I also find that I have to spend a lot of time trying to figure out exactly what they're doing, partially just because their programmers seem to know more about how to make my Web browser jump through hoops than anyone else on the Web!

To get started, you'll want to log in to your AdSense account, then click on the Ad Settings tab. The first section is labelled "Ad Type" and you should see this:
Ad Type selector including AdSense for Feeds

Click on the new "AdSense for feeds unit" and select the type of Weblog program you're running out of the choices (Blogger or Movable Type/Typepad).

In the "Your AdSense code" box you'll see the code you should add to your feed, but don't do that yet. You want to create a unique channel for your RSS advertising first, so you can track impressions and click thru rate. In the middle of this same page, there's a section that lets you work with channels:
Configuring channels for your AdSense for Feeds ads

Click on "manage channels", then type in the name of the channel you want to create (I used "RSS Feed") and click "create new channel". It'll look like this:
Create a Unique Channel for your RSS Ads

Now, click on the "Continue to Ad Layout >>" link at the bottom of the Channels page and you'll be back to your original page, but now you can select the new channel!

Now in the "Your AdSense code" box is a bunch of obscure looking HTML that you'll want to copy and paste into your RSS template. Let's look at that part next.

If your browser supports tabs, I'd recommend that you create a new tab before you move to your Weblog configuration page, so you can flip back to the Google information with ease.

If your Movable Type configuration is like mine, you'll have a "Templates" link on the left side of the main page, which, once you click on, will reveal all your templates, including both an RSS 0.91 and RSS 1.0 index page.

Click on the first one, "index.xml", and you'll be looking at your template, which is about as scary as a file gets in the blogging world!

Somewhere in that jumble is a code section that looks like this:
<$MTEntryExcerpt encode_xml="1"$>


Position your cursor just before the tag, insert a few blank lines, then back up one and paste in the code from the Google AdSense page. Click on SAVE then click on the bottom REBUILD button and you'll be able to quickly rebuild just the target file.

You'll want to do a similar thing to the "index.rdf" file too. The XML that's shown therein is a wee bit different, but the same basic technique will apply.

Now, to test it, subscribe to your RSS feed from within you favorite RSS Aggregator (I like NewsGator Online, personally). Your ads should show up pretty much instantly!

Now don't forget to read my Best Practices: AdSense for Feeds and AdSense for Feeds: Any Risks? before you go too much further.

Congratulations, you now have adverts in your RSS feed. Good luck with them. Me? I think you should only have adverts in full text feeds, as I talk about at length in the following article about Ads in RSS Feeds? Corrupting the idea of information syndication.

Thursday, October 22, 2009

How To Add The Blogger “Read More” Expandable Posts Link

This is a pretty popular Blogger hack that lots of people have asked me about. Instead of answering to each email individually, I thought it would make more sense to write an article about it.

With this hack, you can choose to display a select amount of text from the beginning of each post as a teaser instead of showing the entire post on the front page of your blog. Then when people want to read the rest of the post, they can click a “read more” link to see the full post. This is very handy if you have lots of long articles all on one page. (Note that you’ll need to have post pages enabled in order to make this feature work.)

Step #1 – Update Your Template Code

First you need to edit your existing code so I recommend copying and pasting it into notepad or any text editor. Also, it’s smart at this point to create a backup of your template just in case something goes wrong. Now do a search (CTRL + F) within the text editor for the following code post-header-line-1. This is the default code that Blogger includes but some custom templates remove or change this code so you might have trouble finding it. If you can’t locate this text then try searching for instead. Your template will for sure have this since it’s the tag that actually prints the body of your post.

Now depending on which code you were able to find will determine how easy the next steps will be. You might need to do some detective work first in order to get this working properly in your custom template. The idea is to get this new code into your template before the tag. Keep reading and hopefully the explanation will illustrate the concept clear enough so you are able to adapt this hack to your custom template.

Add the following code below the

and
tags if you’ve got both.









The result should look something like this:

new-code-block.png

If you don’t have the default

tag then your result should look something like this instead. This is how it would be done in the MushBlue Blogger custom template:

new-code-block-mush.png

Notice in both examples that the code in yellow and the tags are the same — it’s just tag above it that will differ based on the template you’re using.

Now let’s add one more bit of code which will actually create the “read more” link in your post. This code will go below the tag so copy the following and paste it in. Feel free to change the “Read more…” text to whatever you want the link to look like. Be careful not to delete any other code during this process.





Read more...



Yes, there are supposed to be two tags in the above code so don’t think it’ s a mistake. The result should look like this:

new-code-block-2.png

This code will be the same no matter what template you are using. Just make sure it goes below the as shown in the image above.

Now let’s look at what the final result should be. Here’s the updated code block you just worked on all put together:

new-code-block-3.png

Ok, you’re all done editing the template code. Paste it back into your Blogger html window and save it. If you get an error, you made a mistake. The most common mistake is to accidentally delete a > or <>

Step #2 – Add a Class Tag in Your Default Post Template

For this step, you need to navigate in your Blogger account to “Settings” => “Formatting” and scroll all the way down to the bottom. It’s the last option called “Post Template”. You’re going to paste in the following code:

You’ll want to keep the spaces in there which will make sense later. After you save this, it will look like this:

post-template2.png

Step #3 – Create a New Post

Ok, we’ve got everything all setup so it’s time to go and test it out. Hopefully you’ve got a new post in mind for your blog. If not, then we’ll just create a test post which you can later delete. When you click on the “Posting” tab, you’ll notice that the post text area is now pre-populated with the and tags. If not, then you didn’t save it properly so go back and re-read step #2.

So when writing your new post, anything you put above the tag will be the teaser text. The main body of your post needs to go in between the and tags in order for the “read more…” link to work properly. See the screenshot below. Sometimes pictures illustrate better than words.

post-template-result2.png

Now publish or preview your post to see the “read more” hack working on your blog. If it doesn’t show up for some reason, go back and run through the steps again. Most likely you pasted the code blocks in the wrong places. It’s difficult to troubleshoot these issues since each template can be unique so please make sure to double-check your template before asking for help in the comments section below.

Here’s the live post with the “read more…” link properly working based on the text I used above in the post text area.

post-results.png

Additional Info

If you want to go back and update your old posts with this new “read more…” feature you can. Just go back and edit each post manually. Essentially you’ll need to paste in the and tags breaking apart the post into two parts.

For some posts, you might not want to use this feature at all. If that’s the case, just delete the and tags from within your new post text area. Then your new post will show up entirely just like it used to before you implemented this hack. Enjoy!

Ready to super charge your blog? Check out our professional premium blogger templates or make money by joining our blog affiliate program!

If you like this post then please consider subscribing to our eBlog Templates RSS feed. You can also subscribe by email and have new templates and articles sent directly to your inbox.

 

Followers

Site Info

Copyright © 2009 Blogger Template Designed by Bie Blogger Template Vector by DaPino