Showing posts with label Template editing. Show all posts
Showing posts with label Template editing. Show all posts

Lining up the first post and the sidebar

In some Blogger templates, there is a big gap between the bottom of the header and the start of the first post, and this means that the posts and the sidebar are not aligned.  This article explains how to adjust the gap, and so remove that problem.



In the templates that Blogger provides, as well as all third-party templates, the amount of space between elements on the screen is not accidental:   designers put a lot of effort into working out what spacing will look good, and then finding ways to put CSS code into the template so that the spacing they want is shown in any browser software that Blogger supports.


But there are times when you may want to change this spacing, and this is easy to do, provided you are willing to accept the disadvantages of editing your template, and if  you can work out exactly which part of the template code to change.


The pre-Header gap

A pet-hate of mine is the blank space above the first post, which looks strange unless you put something else in to the space.  In this example, I've got an AdSense link-unit in the area highlighted in red, just to fill in the empty area:




How to change the gap above the post header

1  Edit your template  - don't forget to take a backup.


2  Find this code
h3.post-title, .comments h4 {
  font: $(post.title.font);
  margin: .75em 0 0;
}
The exact numbers used in your template may be different:  the key thing is to find the CSS command that is putting a margin above the post header.  In the template that I took this example from (Simple), it's the "0.75em" - which puts 75% of the space of a the post-header characters as a blank space above the header.


3   Change the first margin value:  how much to change it by depends on your template, but in some cases I've used 0 successfully.

In CSS, when a margin statement has three numbers beside it, they refer to the
  • top, 
  • left-and-right, 
  • bottom 
margins respectively.   So if you want to do something else to the post-header, eg indent it, this is the place to make changes


4   Click Preview to see what the blog will look like - keep doing this until you get the right setting.


5   When you are happy with the spacing, click Save Template to apply the changes to your blog.   (Or Clear Edits if you cannot get it right and need to stop trying).


Note:  If you make a big change to your template like this, it would be a good idea to check out out in at least one version of the other browsers that your readers use - at the moment, this usually means Internet Explorer 8, Firefox and Chrome.   But it may depend on your niche - a tool like Google Analytics will give you some statistics about what browsers, and screen sizes, your visitors have.

Also, it is possible to make this change by just installing a new CSS rule for h3.post-title into your blog - because the latest one found is always the one used, and because the template designer's Add CSS function puts the rules you add after the othr rules.   I don't recommend it here, though, because working with the original rule makes it easier to see the effect of making changes to any of the values in the area.


Other affected spacing

If you have more than one post per page, then this change will also reduce the amount of space between the bottom of one post and the header of the next one.   Depending on your template, you want want to add a little more space into the margin statement in the bottom of the post-footer, eg
.post-footer {
  margin: 20px -2px 20;
  padding: 5px 10px;
}

If you display comments in your blog, you also need to check the impact on comments, because the original command applied to h4 items in comments as well.

If you are making a lot of changes, you may want to make a test blog, and plan your changes in private before applying them to your main blog.




Related Articles

Setting up Google Analytics to get statistics about for your visitors

Adding a new CSS rule to your blog's template

Advantanges and disadvantages of editing your template.

How to edit your blogger template

Who did your blogger template come from - the quick way of finding out

Making a test-blog for template changes

Planning changes to your blog in private

How to centre-align the sharing-icons from AddThis in Blogger

This article shows how to get and then centre-align the row of sharing items that you can get from AddThis (and it's likely that a similar technique applies to sharing buttons from other services like ShareThis, too).



If you think that Blogger's own social sharing buttons a just a bit too small and difficult position, then you may decide to use a service like AddThis to generate buttons that are more elegant all round.

Signing up with AddThis is easy: just log in to your Blogger account, and in a separate tab open up AddThis.com. Choose Create Account, and then Continue with Google. This links your Google account and your AddThis account, and is the easiest approach - but there are other options too, like creating your account with your Facebook or Twitter accounts, or even just signing up the old fashioned way with your email address.

Once you have signed up and chosen a plan (personally I just the free "Basic" plan), you need to actually install the AddThis buttons on your site. To do this:
  • Select one or more sets of sharing buttons (from the options available to your account type),
  • Choose the settings which apply to that set of buttons
  • Choose Activate (button in the bottom right corner of the setting screen), and
  • Install the code that AddThis gave you into your blog.

Installing the code that AddThis gave you is pretty much like installing any other piece of code.   Typically the code you have to install has two parts:

For the piece that says:
Step 1: Add the following code to the <body> of your website.
Search for "<body"  (note:  no closing angle-bracket because some templates have extra instructions in there), and then put the code from AddThis after the angle bracket that goes with the <body


For the piece that says:
Step 2: Paste this code into whichever page you would like this tool to show up.
Find the location in your template that you would like the gadget (eg an HTM gadget, or inside the post statement itself - read more about the options), and copy and paste the relevant code from AddThis.




But it's not in the right place.

If you install the code as is from AddThis, you will find that the row of sharing buttons is pretty tightly linked up with the rest of the page, and left-aligned.   Fortunately this is easy to change.


How to centre (or right align) rows of buttons from AddThis 

To put the set of sharing buttons from AddThis at the middle of the page, you need to surround the 2nd piece of code from AddThis with another Div statement, like the one in bold below:
<div style = 'width:100%; text-align: center; margin-bottom:3em; margin-top:2em;'><!-- Go to www.addthis.com/dashboard to customize your tools -->
<div class="addthis_sharing_toolbox"></div>
</div>
The exact details to use depend on how exactly you want to set up your sharing-bar form AddThis.  I wanted it to be centre-aligned on one of my sites, with some extra white space above and below, so I used these commands:

  • width:100%  -  says to use all of the page-width in deciding where to put the sharing bar  (by detfault, it would just use the width of the sharing bar itself
  • text-align: centre   -   means that he bar will be put in the middle
  • margin-bottom and margin-top   put some extra space above and below the gadget, so it sticks out more-so.


But you may use a different approach, depending on what your blog is trying to achieve.

What your readers see

Visitors using a web-browsers

Will see your AddThis buttons, as you defined them

Readers who subscribe to your blog's RSS feed

Will not see your blog's AddThis sharing buttons, unless they happen to click through from their feed-reader to your blog.

Readers who follow-by-email 

Will not see your standard social sharing buttons at all, unless they visit your site.   (AddThis does have some email newsletter buttons, but these don't automatically go into emails generated from Blogger).


Is it worth it?

For what it's worth, I recently made the change from custom sharing buttons that I'd made myself to classier looking ones from AddThis, and saw quite a jump (50% or more) in the number of social shares, across all my sites.

YMMY, of course.



Related Articles

Installing 3rd party code into Blogger

Using Div statements to control layout

How to tick the "expand widgets" checkbox in Blogger's new template editor

This QuickTip is about finding the "expand widgets" option in Blogger's template editor.



Today, Blogger Buzz announced a new version of the template editor.

This is exciting in all sorts of ways, including that it implies that Blogger will continue to support template editing:   some people suspected that Dynamic Templates, which don't allow template editing, might be the way of the future.

But there's one immediate issue: many of the existing "How to do XXXX in Blogger" tutorials include statements like
Open your template for editing, and tick the "Expand widgets" checkbox

or

Open your template for editing, and make sure that "Expand widgets" isn't ticked


However today's changes have deleted the Expand Widgets checkbox.

So - what do you do if you need to expand the widgets?   Luckily, this is one of the things that has been made easier, once you find out where the option has moved to.


How to see expanded code for a gadget / widget


The equivalent of ticking the "expand" check-box is to:


1)    Find the gadgetID in the usual way.


2)   Open the template for editing, and find the reference to the widget / gadgetID in the code
(Either using the browser's find feature - or  the "Jump to Widget" feature that is now in the post editor.)


3)    Click on the fold marker for that gadget.
This is the horizontal arrow ( ? ) which is in the very left side of the editing window on the same line as the gadget name.

Clicking it turns the sideways arrow into a down-arrow, and shows you the code that's included in that gadget - or at least as much of it as Blogger is going to let you see.




To un-tick the expand check-widgets checkbox, just make sure that all the fold-arrows are horizontal. (they work as toggles - clicking them changes them from one expanded to contracted, or vice versa).


What else has changed?

I'll be updating Blogger-HAT's main "How to edit your Blogger template" article soon - this is just a quick heads-up to start with.

If you've found any more features of the new template editor that you like (or don't) or which need more explanation then drop a comment below and I'll see what I can do.