Background Images for Widgets in Blogger

In terms of customization the options that Blogger provides might be limited but with custom styles and codes you can do almost anything to the looks of your blog. With this tutorial you will learn how you can set background images to the widgets in the sidebar or anywhere.



Upgrade your blog's look by setting custom images (your choice!) as the background on widgets on your blog. We will guide you through setting background images on widgets on your blog, either on sidebar & footer or just the sidebar.

Before you make changes to the template I recommend you to take a backup of your blog template.

Set Background Image On All Widgets

If you want a image background on all of the widgets on your blog then follow the instructions below, the other section deals with adding a background image to particular widget(s) which goes a bit into technical stuffs.

First Get An Image

Before anything else we need an image somewhere on the web that you can use as  the background. Simplest way is to upload an image in a draft post on Blogger, then right click on it to get its direct URL.

For example I have this image:
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRbyvldP5eJrx_heAusfssXVnV0tfteAR0x8rrGNd76UH3YpNWmi5AO_B8v-L_PgjCepihCNauujdZ32OebvKCr7uT48YpfpujRUM0akwypQ8ZcFtoJWKNildJsDXIFVLcw3ceQl78y44p/s1600/samle-image-001.jpg

Make sure your image wide enough to cover the width of the image, as for the height you may also keep it in accordance with height of the widgets but it is not in this case useful as some widgets might stretch more vertical which may require the image to be stretched too, but instead of stretching we can just tile it downward to fill in the blank area.

The CSS Snippet

To get the image applied as background we would use this small snippet that sets the image on every widget (including the widgets in footer, you can omit the line specified if you don't want it on footer)

.sidebar .widget .widget-content
,foooter .widget .widget-content {
background-image: url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRbyvldP5eJrx_heAusfssXVnV0tfteAR0x8rrGNd76UH3YpNWmi5AO_B8v-L_PgjCepihCNauujdZ32OebvKCr7uT48YpfpujRUM0akwypQ8ZcFtoJWKNildJsDXIFVLcw3ceQl78y44p/s1600/samle-image-001.jpg');
background-repeat: no-repeat repeat;
background-position: top center;
background-size: cover;
}

Replace Image URL:
The third line is basically the one you have to change. Currently the image pointed in the code is what I have set it, but for your images you have to enter your image's URL in the snippet.

background-image: url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRbyvldP5eJrx_heAusfssXVnV0tfteAR0x8rrGNd76UH3YpNWmi5AO_B8v-L_PgjCepihCNauujdZ32OebvKCr7uT48YpfpujRUM0akwypQ8ZcFtoJWKNildJsDXIFVLcw3ceQl78y44p/s1600/samle-image-001.jpg');

The highlighted area in the code is the URL of the background image, when you copy the code replace the highlighted area with your own image's URL and then apply the whole CSS code to your blog.

Don't Apply To Footer Widgets:
In case you intend to only apply the background image to sidebar widgets then omit the following piece of highlighted code from the snippet:

,foooter .widget .widget-content {

Do not remove the "{", only the highlighted area is supposed to be removed.

Now Apply The CSS

Here is a quick tutorial on adding CSS code to your Blogger blog with easy demo steps

Decorative Backgrounds for Holidays

Christmas and New Year's Eve is near, everything on the web has almost blended into the festive look so why not your blog? Use the steps provided above with these pre-made images that will give your blog an impressive look. Just right-click, copy the image URL and use it with the code in the previous section.

Moreover you can always select your own decorative background image from around the web or look at some very creative designs on Creative Market that you might find useful.

So have a great Christmas and happy new year! See you in 2016. 

Renaming "Older" and "Newer" Page Links in Blogger

Two years ago I wrote a post on hiding "Newer"/"Older" pagination links on Blogger and I was recently asked by a reader if it was possible to rename the links name, yes it is, and in this tutorial you are going to learn that the safe way.

Why is it the safe way, is there any side-effects? Not really, but this tutorial takes you into editing a few lines of code in your template so chances are that if you accidentally make any mistakes then the template might just broke and you have to fix that problem first to get your blog running again.





Back-up the Template

As a precautionary step make a backup of the template so that if anything goes wrong you can always revert it back to the current template: How To Backup Your Template

Two Ways To Do It

Before we start take note that we are presenting you two different ways to do this. The first method affects it from the root while the second one is like a layer, it renames it using JavaScript code when the page is loaded.

Difference? The first method internally changes the name to what you like, the JavaScript way is done on the front-end i.e when the page is loaded the text on the pagination links is internally still what it was but the JavaScript code executes and changes the document dynamically on the client-side to change the name.

#1 Method: By Replacing HTML/XML Codes

Note: We assume you are using not using a third-party template. Though this may work with third-party templates too but the naming convention is uncertain for them so we can't be sure if the code we are asking you to search exists in your template or not.

Follow the instructions carefully to rename the "Older" and "Newer" page links.

1. Go to your Blogger Dashboard -> Template -> Click on "Edit HTML" button to open the template code editor


2. Once the template editor opens put your cursor in the code area and then press CTRL+F/CMD+F and look for the following line by entering it in the search box

<b:includable id='nextprev'>

Searching for this line must bring up the matching line of code where we have to make the changes. If there is a triangle arrow on the left of the line in code editor then click on it to show the code inside it.



3. When you click on the triangle right arrow the code inside it will show up and it should be something like or may even be the exact.

<b:includable id='nextprev'>
<div class='blog-pager' id='blog-pager'>
<b:if cond='data:newerPageUrl'>
<span id='blog-pager-newer-link'>
<a class='blog-pager-newer-link' expr:href='data:newerPageUrl' expr:id='data:widget.instanceId + &quot;_blog-pager-newer-link&quot;' expr:title='data:newerPageTitle'><data:newerPageTitle/></a>
</span>
</b:if>

<b:if cond='data:olderPageUrl'>
<span id='blog-pager-older-link'>
<a class='blog-pager-older-link' expr:href='data:olderPageUrl' expr:id='data:widget.instanceId + &quot;_blog-pager-older-link&quot;' expr:title='data:olderPageTitle'><data:olderPageTitle/></a>
</span>
</b:if>

<a class='home-link' expr:href='data:blog.homepageUrl'><data:homeMsg/></a>

<b:if cond='data:mobileLinkUrl'>
<div class='blog-mobile-link'>
<a expr:href='data:mobileLinkUrl'><data:mobileLinkMsg/></a>
</div>
</b:if>
</div>
<div class='clear'/>
</b:includable>

4. Now look for <data:newerPageTitle/> and <data:olderPageTitle/> in the above code inside your Blogger template code editor. To make it easy we've highlighted the lines which contain these two codes.

<data:newerPageTitle/> - Generates the newer page link text, by default "Newer Post"/"Newer Posts" for post page and index/archive pages respectively.

<data:olderPageTitle/> - Generates the older page link text, by default "Older Post"/"Older Posts" for post page and index/archive pages respectively.

Replace each with the text you want in place of it. For example suppose I want "Previously Written!" & "Next For Read!" to replace the default text then my code would look something like this.

a. For "Older" page link I would replace the 2nd highlighted part with this:

<a class='blog-pager-older-link' expr:href='data:olderPageUrl' expr:id='data:widget.instanceId + &quot;_blog-pager-older-link&quot;' expr:title='data:olderPageTitle'>Previously Written!</a>

b. For "Newer" page link the edit on the 1st highlighted part in the main code above would be this

<a class='blog-pager-older-link' expr:href='data:olderPageUrl' expr:id='data:widget.instanceId + &quot;_blog-pager-older-link&quot;' expr:title='data:olderPageTitle'>Next for Read!</a>

Use your own text you want to replace the default pagination link text and then save the template. If you did it right then the changes must appear on the blog like this:


#2 Method: Using JavaScript

This doesn't require much edits and is also easily revertible. But this is just like a layer, while the actual text that was generated during the page was still the default one, this JavaScript changes the DOM to the change the text inside the specific page links.

<script type='text/javascript'>
function changePageLinkText(a, b) {
document.getElementById("blog-pager-older-link").children[0].innerText = b;
document.getElementById("blog-pager-newer-link").children[0].innerText = a;
}
document.addEventListener("DOMContentLoaded", function() {
var newerText = "Enter Newer Text"; // Replace [Enter Newer Text] with your own text
var olderText = "Enter Older Text"; // Replace [Enter Older Text] with your own text
changePageLinkText(newerText, olderText);
});
</script>

Replace the text "Enter Newer Text" and "Enter Older Text" with the text you want to appear in the corresponding links.

To place this code in the template, go to Blogger Dashboard -> Template -> Edit HTML -> Now press CTRL+F/CMD+F and search for </body> and place this immediately before it.

Now save the template and the text on the pagination links will change according to what you've set in the code. You can edit the variables in the JavaScript code anytime you like to change the text that appears.

Note: this may not work in some older browsers and also in browsers that turns off JavaScript.

Adding AdSense Ad Inline With Post in Blogger

There are numerous tutorials and tips on increasing revenue on AdSense by using different ad placement techniques and practices, many of them work great, but Ads in the main body content is one of the most vital place.


Ads placed in post body can make a significant difference in the revenue but you have to do it wisely, it is where the main focus of a site's visitor is for most of the time during their visit so it is important to make sure the experience is not obstructed for the visitor due to the ads.

In this tutorial you will learn a simple way to add AdSense ad in your post and have it display in a good manner that is by floating the ad to a direction and have the paragraphs wrap around it.

Set Things Up

You can simply paste an Ad code in the post editor and the ads will appear but that isn't always what you need. How about floating it to the left or the right so the text wraps around it? We are going to learn just that by using simple markup and CSS so you can selectively add the Ads to any post at the best position you like.

Add The CSS Styles

We will get onto the main part where you have to work with the ad codes later before that let's set a few lines of CSS that is going to complement the box which is going to contain your Ad. This tutorial is meant for square ads only.

/* By default it floats to left */
.ad-container {
float: left;
padding: 10px 0;
padding-right: 10px;
}

/* For ads floating to the right */
.ad-container.right {
float: right;
padding-left: 10px;
padding-right: 0;
}

/* Centered Box */
.ad-container.center {
float: none;
padding: 10px 10px;
text-align: center;
}

/* Clearing floats */
.ad-container br {display: none;}
.ad-container:after, .ad-container:before {
content: "";
display: block;
clear: both;
}

If you are not sure where to add this CSS code please check the guide on adding CSS to a Blogger blog

The HTML Container

What does this do? Well, you can, as I already mentioned, paste the Ad Unit's code provided by AdSense in the HTML mode in the post and the ad will start appearing but you get a very little and not-an-easy option to position the ad as you like. With this you can.

Copy the following code and have it saved in your favorite text editor so you can use it in the next steps easily.
<div class="ad-container">
<!-- Paste your code here -->
</div>

The HTML markup is simple, just put your AdSense code between the first and the last line i.e where <!-- Paste your code --> is and that is it.

You need to know a small thing if you want to have the ad centered to floated to the right as by default it floats to the left. Check the following line of codes trimmed from the HTML markup provided above.

<div class="ad-container center">
We added the keyword "center" in side the class="" attribute. If you want the ad to appear centered then you have to add it too to your markup.

<div class="ad-container right">
In case you need it on the right just add "right" in there and that's it. Simple!

Once you have this markup ready with your AdSense Ad code you may proceed to the new steps that guides you through adding it to the post through post editor.

Put The Final Code In Post

By now we assume that you have finalized the code i.e edited the markup and included your ad unit code where described.

To put it into your post click on the "HTML" button when you are in the post editor



After switching to the HTML mode paste your code around the text where you want it to appear. Mostly ads are put at the start of the blog post but if you wish you can put anywhere for example at a position where you know the readers are going to spend most time reading or focusing. 

Make sure that when you paste the code anywhere in the post in HTML mode you paste it outside a <span> or <div> tag that may be there to contain some other text or paragraph/image.

For any further help on this you may use the comment box below to let me know. 

Now Drag & Drop Images in Post Editor in Blogger

Blogger has announced a new and very useful: Drag and Drop images in directly draft posts to upload them!

Credit: http://www.memegasms.com/


Blogger's post editor has been on a very slow improvement over the time, though it is now free of many bugs and errors that caused havoc among Blogger authors while even writing a simple post.

How Do I Know?

Open up a post in the editor and drag and drop an image from your computer in the post editor (in Compose mode) and the images will be uploaded and added to the post as you would've done with the "Insert Image" option in the toolbar.

When you click the "Insert Image" icon for the first time you will be presented with the notification letting you know about the new feature so that you can use it from next time instead of proceeding with a little lengthier process of selecting > uploading > again selecting and placing the image.

From the official Blogger Help Forum thread
It makes it easier for a blogger to place images in the post. A great relief for people who happen to upload a lot of images on their blogs.

Wasn't it possible already?

No. Before you could sure drag and drop images into the post editor and it would have even shown up but it' was not the same without the support it has implemented now. When you did that before the images were not uploaded to any server instead were added into the post as long series of text that encoded as the image's data.

It isn't the best practice for drag and dropping image though, so we said no to it.