Learn to customize your own blog with confidence

Code it Pretty is an archive of tutorials from 2012-2015. Tutorial details may be outdated. More Info

Thank You

Photo from Unsplash

The end of summer always feels like the beginning of a new year for me. When I was a kid it was, quite literally — my new year of school always started after Labor Day. But even now, when the summer starts to wind down, I start thinking about my plans for the "new year".

This year while I was making those plans, I decided that it's time to bring Code it Pretty to a close.

There's no big standout reason why. It's a bunch of little reasons that all boil down to time. The time I would spend on Code it Pretty is time I want for other things now.

Many, Many Thanks

Before I go off to the next adventure, I want to thank everyone who has ever left me a comment, question, or idea for improvement. I have learned so much from you. Your questions made me a better teacher and writer. Your feature requests and critiques made me a better coder. I'll always be grateful for that.

I also want to thank again everyone who took the time to send me a note to tell me about how this blog helped you. Those notes always made my day. I hope I managed to reply directly to you — I really did try!

The Future of Code it Pretty

I'm going to leave this blog online indefinitely. For now, the majority of the tutorials are still up-to-date and useable. But, over the next few days I'm going to close comments on the posts and put a note up top to let readers know that this is now an archive, not an active blog.

If I could make a wish about the future of this blog, it would be that many people would use it in the spirit of the Creative Commons license I gave it, and take pieces of it to build something new. That would make me really happy and proud. If you can make something fun or educational from the things I wrote & made here, or if you can translate it into another language, please do — and let me know about it! I'll still be active on Twitter and Google+, or you can email me.

Thanks again, sincerely. And have a happy "new year" :)

Link Pinterest Pins to the Right Post on Blogger

the Pinterest link fix for Blogger

Have you ever clicked on a Pin that took you to the home page of a blog instead of the post you wanted to see? Today I'm sharing a bit of code to help prevent that problem on Blogger.

Pinterest created a special image attribute, data-pin-url, that lets you add your post's permalink to all of the images in the post. Pinterest will link images with this attribute to the right post no matter what page your reader is on when they Pin it.

It's a time-consuming chore to add this attribute to all of your photos one-by-one, so I wrote some JavaScript to do it for you automatically!

What This Code Does

This code adds the data-pin-url attribute to every image in posts on your home page and the "index" pages (archive, label, search, "older posts", and "newer posts" pages). The attribute links each image to its original post.

After you install this code, new Pins created from posts on your home page or index pages will link to the right blog post, not the home/index page. This code can't change old Pins. It can only prevent future mixups!

Template Compatibility

This code works on all of the standard Blogger templates except Dynamic Views, which does not accept custom code.

It also works on custom templates that have the same internal structure as a standard Blogger template.

Installation

Back Up Your Template

Backup instructions here. Do not skip the backup.

Open the Template Search Box

After you save your backup file, click the "Edit HTML" button below your "Live On Blog" screenshot.

Next, open the template search box to search your code. Your browser's search function can't search the code, so be sure to follow these three steps exactly.

  1. Place your cursor on the template code.
  2. Click once.
  3. Press CTRL and F at the same time (PC) or Command and F (Mac).

The search box will open in the upper right corner of the template editor. It looks like this:

Blogger template search box

Enter </body> in the search box, then press enter. The code will "jump" down to the </body> tag in your template and highlight it in yellow.

Copy the Code

Select and copy the entire code from the code box below. Only copy the code, you don't need the line numbers.

If the embedded code doesn't load for you, or you're having trouble copying it, you can copy it from here.

Paste the Code

Paste the code into your template, directly above the highlighted </body> tag. Next, press the "preview template" button. If you get an error message, press the "revert template" button and start over. Otherwise, press the "Save template" button.

Test the Code

There are two different ways to test your installation.

Test Option One - Create a Test Pin

Go to the home page of your blog and create a new Pin from any of your post images. After you create the Pin, go to Pinterest and click on it. It should take you directly to the post page, not your home page. You can also try this test from any index page to double-check!

Test Option Two - Check Your Blog's Source Code

If you'd rather not create a new Pin, you can check your blog's source code to confirm that your new data attribute is in place.

Visit your blog's home page in Chrome or Firefox. Hover your cursor over any image in your blog post and right click it. Select "Inspect Element" from the context menu. You'll see something like this screenshot (click to enlarge):

Look for the data-pin-url attribute inside the img element. If it's there and the URL is correct, you're all set!

Note: this code adds the data-pin-url attribute to images on the home page and index pages only. The attribute isn't necessary on post permalink pages because Pins created from permalink pages automatically link to the correct page.

Alternate Version with data-pin-description

Pinterest has another attribute that's supposed to control the description of your image, data-pin-description. But, only the Pin It hover buttons pick up the text from this attribute reliably — the Pinmarklet and the Pinterest browser buttons don't always recognize it on Blogger.

If you don't mind a little inconsistency with your Pinterest descriptions, you can set both the data-pin-url and data-pin-description attributes for your images with this alternate version of the code. The installation process is the same as the url-only version. The alternate code adds both the data-pin-url and data-pin-description attributes to your post images. The code uses the post's title for the data-pin-description attribute.

More Pinterest Attributes

Pinterest has two more image attributes: data-pin-media, which you can use to specify a Pinterest-specific image for your posts, and data-pin-id, which counts new pins from your page as a "repin" on your original pin.

This post on Pinterest's blog has the full details of all four attributes. After you read that, this post from Blog Chicka Blog will show you how to add them to post images by hand. The tutorial shows how to do it on WordPress, but the same basic technique works on Blogger, too. Remember that you don't need to add data-pin-url if you're using this code (and data-pin-description if you're using the variation) — the code will do it for you!

Happy Pinning!

Lessons from 3 Years of Running a Tutorial Blog

Three Lessons from 3 Years of Running a Tutorial Blog

When I first started Code it Pretty, I searched for a guide to running an all-tutorial blog. I found generic advice about how to write a good tutorial, but nothing about the day-to-day experience of running a tutorial blog — the type of blog that's going to get an avalanche of questions, most of which really need answers.

Over the 3 years since I started, I realized why I couldn't find that guide; there is no one true way to run an all-tutorial blog. The process that works for me is very personal and came from a lot of trial and error.

But, that doesn't mean that there's nothing to be said about how it's done. Though this is not — and can't be — the definitive "tutorial blog handbook" I was looking for, I'm sharing some lessons I've learned and strategies I've developed to keep my blog going strong without stressing myself out.

Inbox Zero Ain't Happening

When I put a tutorial out into the world, I know I'm going to get questions. In fact, I hope I do — if I don't, nobody's reading!

At the beginning, I tried to answer every comment and email. It wasn't possible to keep that up over time, so I came up with limits and policies to help me manage all the questions I get without getting seriously overwhelmed.

Set limits. I set firm limits for myself about when I respond to questions. I have a set window of time for answering questions on weekdays. After that time is over, I stop reading/answering questions for the day. On the weekends, I don't answer questions at all. That boundary is a big help in keeping me from burning out.

I try to answer as many questions in my tutorials' comment threads as I can, but sometimes I just can't keep up. When I'm too busy, I'll skip over some comments without beating myself up over it. Vague comments (like "this doesn't work for me" with no other details), and questions from people who clearly haven't read the entire tutorial are just begging to get skipped, so they're the first ones I'll let slide.

Create policies and make them known. I have one set-in-stone policy about how I answer tutorial questions — I only answer them in the comment thread for the tutorial. That way, when another reader has the same question, my answer is right there on the same page as the tutorial.

I'm super up-front about this policy. It's on my Ask page twice. The Ask page is the only place I list my email address, so if a reader is emailing me, they've definitely had the chance to read my policy.

Since I put that policy in place, the email I get with tutorial questions has decreased significantly. I still get a handful every month, but they get the lowest priority in my inbox (and I don't stress about it). When I get around to answering I send a form letter that gently repeats my policy and points back to the comment thread.

Put together a file of "ready made" responses. Having some form letters and pre-written bits really helps me answer questions faster. At first I kept a Google Docs file of all my pre-written stuff. Now I use TextExpander, a Mac app that lets me type in my saved responses with just a few keystrokes.

Always. Be. Revising.

I think of my tutorials as living documents. I've never written a tutorial that was permanently finished on its first day of publication. I tweak, correct, and revise all the time.

Update your tutorials as soon as you can when something changes. I write about technical stuff, so change is constant — blogging platforms get updated, the tech I write about changes, and my own skills evolve. I make many small revisions throughout my blog every month. Sometimes, I'll completely rewrite and republish an old tutorial to bring it up to date.

If you have to repeat yourself often, figure out why and revise. When I write answers to questions, I pay close attention to when I'm repeating myself. Sometimes, it's unavoidable — I know I'll always have to ask questions that start with "Can you be more specific..." and "Can you link me to where you're using the code...". That's when my pre-written responses file really comes in handy.

But, when I find myself repeating the same exact detail about a tutorial in my answers, I know there's a problem with the tutorial and I need to make a revision. Either something is missing from my instructions, I haven't explained it well enough, or I need to use a visual cue to keep readers from skipping over something important.

Kill Your Darlings

William Faulkner said, "In writing, you must kill all your darlings". I wouldn't go as far as old William there, but sometimes a tutorial I love a whole lot still has to die.

I've deleted posts that I put a ton of time, effort, and care into. In most cases it was because they were about things that don't exist anymore. But, in two particularly painful cases, I simply failed at teaching something complicated, and I couldn't revise my way out of it. It's a bummer to dump hard work, but trying to support obsolete or ridiculously difficult tutorials is worse.

When I do kill a "darling", I redirect the post's URL to another relevant page on my blog so anyone following a link to the old post won't end up on my 404 page. If there's nothing else like the deleted post, I redirect to the home page or my "Tutorials by Topic" page so the reader isn't completely lost.

Background image in title card from (affiliate link) Creative Market

How the Google Code Shutdown Can Affect Blogger Designers

My 2014 tutorial "Truly Simple Slideshow for Blogger" redirects here because new installations were disabled during the shutdown. If you have the gadget installed, please be aware that it will stop working in January 2016.

This is a quick note for all my readers who design or develop Blogger themes — especially those of you who do it professionally.

On March 12, 2015, Google announced that they are shutting down Google Code, their open source code hosting service. The service is now closed to new projects, and will close entirely in January 2016.

Google Code's shutdown does not affect Blogger directly. But, if you add 3rd party customizations to your templates, you should be aware of how this can impact your work.

Many independent Blogger developers use Google Code to host the source code for their Blogger customizations. This includes popular add-ons like social media buttons, slideshows, and galleries that many designers rely on for their custom templates. It's worth checking your templates now for anything hosted on Google Code so you can start planning updates well before the shutdown.

How This Affects Code it Pretty Gadgets

If you only customize your templates with Code it Pretty stuff, you're mostly in the clear (and I'm flattered!). My Truly Simple Slideshow for Blogger was the only project I host on Google Code. Everything else is GC-free. Right now I have no plans to rehost the slideshow gadget.

If you already have it installed, please be aware that it will stop working in January 2016. You're welcome to copy the source code while it's still available and rehost it elsewhere if you'd like to continue using it beyond 2015.

How to Check for Google Code in Your Template

If you're not sure if you're using code hosted at Google Code, it's easy to check.

In a Text Editor

Open your template in any text editor and search for "googlecode" (no quotes). If you find it, your template includes code that is hosted on Google Code. If not, you're in the clear!

In a Browser

Visit your blog in your favorite browser and use the browser's developer tools to search the source. In Chrome, it's under View > Developer > View Source. In Firefox, it's under Tools > Web Developer > Page Source. Search the source code for "googlecode" (no quotes). If you find it, your template includes code that is hosted on Google Code. If not, you're in the clear!

Next Steps

If you find Google Code links in your template, the first thing to do is determine what the custom code does — if you have a lot of custom stuff in there you may have some detective work to do. If you're stumped, try googling the Google Code link. That will usually take you to the tutorial that references it.

Once you've figured out what it's for, take a minute to decide if you still need it. Now's a good time to cut out extra fluff.

If you want to keep it, find out where you got the code from originally and keep an eye out for an announcement about the developer's plans going forward. Some developers may migrate their code to other hosts. Others may be able to change the code to eliminate the need for hosting. Be patient — Google just dropped this announcement on developers last week, and it will take time to make alternate plans.

Going forward, before you add anything new to a template, check it for Google Code sources first. If it has a Google Code link, it's best to consider it out-of-date now and save yourself the headache of having to remove or replace it later.

A Pinterest Gadget for Blogger - Updated 2015

This tutorial is obsolete. The code does not work anymore. This gadget was built with the Google Feeds API, which shut down in late 2015.

If you have the code installed on your blog, I'm sorry that it stopped working. Unfortunately, there's no way to make it work again. You can remove the code from your blog by deleting the HTML/JavaScript gadget with code that begins with this line:

<!-- BEGIN CODE IT PRETTY PINTEREST GALLERY -->

A New Related Posts Gallery for Blogger

related posts gallery for blogger

Today I'm going to show you how to add a customizable related posts gallery to the bottom of your Blogger post pages. This is an independent alternative to nRelate and LinkWithin — you don't have to sign up for a service, share your stats, or show ads when you use this code.

Demo:

This is the related posts gallery I use on this blog. Scroll down to the bottom of this post for a live demo of this code (if you're on a home/index page, click into this post to see the gallery).

Features

What You Can Do With This Gallery:
  • Set the thumbnail image size.
  • Choose square or round thumbnails.
  • Give the gallery a custom title, or leave the title off.
  • Set a minimum and maximum amount of posts to show in the gallery.
  • Track gallery clicks with Google Analytics campaign tagging. This is a good way to confirm if the related posts gallery is actually engaging your readers.
  • Customize the CSS. The default CSS is very basic and won't interfere with your template's design. If you're comfortable with CSS, you can customize it to coordinate with your theme.
What This Related Posts Gallery Doesn't Do:
  • Doesn't show on the home page and won't interfere with "read more" links.
  • Doesn't invent relationships between posts that aren't really related.
  • Doesn't re-route readers through another site before taking them to a related post.
  • Doesn't require you to sign up for an account.
  • Doesn't include branding or backlinks.
  • Doesn't serve ads to your readers.

Technical Requirements

Visible post labels are required. The code relies on your post labels to find relationships between posts. The labels must be displayed on the posts — hidden labels won't work. This works best on established blogs with well-organized labels.

This gallery uses Blogger's built-in post thumbnails, so it works best on blogs that use Blogger's image hosting. If you host your images on Flickr, Photobucket, or another non-Blogger host, you can set a default image for all posts in the code options.

This works on all of the standard desktop Blogger templates except Dynamic Views, which does not accept customization.

This code does not work on private blogs.

Installation

Back Up Your Template

Backup instructions here. Do not skip the backup.

Open the Template Search

Next, open your template by clicking the "Edit HTML" button below your "Live On Blog" screenshot.

We're going to use the template search feature to search your code. Your browser's search function can't search the code, so be sure to follow these directions exactly.

  1. Place your cursor on the template code.
  2. Click once.
  3. Press CTRL and F at the same time (PC) or Command and F (Mac).

The search box will open in the upper right corner of the template editor.

Blogger template search box

Enter </body> in the search box, then press enter. The code will "jump" to the </body> tag in your template and highlight it in yellow.

Copy the Code

Select and copy the entire code from the code box below. Just copy the code, not the line numbers.

If the embedded code doesn't load for you, you can copy it from here.

Paste the Code

Paste the code into your template, directly above the </body> tag. Next, press the "preview template" button. The gallery will not show on the preview, we're just checking for errors here. If you get an error message, press the "revert template" button and start over. Otherwise, press the "Save template" button and move on to the next step.

Check Your Gallery

Go to your live blog by clicking the "View Blog" button at the top of the screen. Click on any post. Scroll to the bottom of the post and look for your related posts gallery. If it looks good, you're done! Enjoy your gallery.

If you need to change anything, move on to the next section: "Options".

Troubleshooting

If you don't see the gallery, make sure you're on a post with at least one label. Remember that visible labels are required. If your labels are not displayed on your post, this code can't work.

If the post has at least one label on display, but there are not at least 3 other posts under that label, your gallery won't appear with the default settings. Check another post with more relatives, or move on to "Options" to see how to change the gallery's minimum.

The gallery matches posts by label. If your blog is brand new, or the post labels are inconsistent, you may not see the gallery. This is because I designed the gallery to only display posts that are related by label — if your post has no label relatives, it won't get a related posts gallery. If you add more posts and/or improve the post label strategy for your blog you'll see the gallery on more posts.

If you have a custom template and can't see the gallery, you may need to change the post label selector and/or the gallery's insertion point. They're the last two settings in the "Options" area.

Options

You can edit the gallery options in the "Code Options" section of the code. The code options section is between two comment lines that read //CODE OPTIONS and //END CODE OPTIONS (you can use the template search feature to find them). The options section looks like this:

related posts code options

Each option setting starts with the word "var" and ends with a semicolon (;). Be careful not to delete the semicolon if you update an option. After you update an option, press the "preview template" button to check for errors before saving.

Set the Maximum Posts Searched

The maxSearched setting allows you to control how far back into your archives the related posts gadget will search. The maximum is 500 posts. If you want the gallery to focus on newer posts you can decrease the search number.

Set a Minimum and Maximum Post Count for the Gallery

Set the minimum to lowest amount of posts you want to show in the related posts area. Set the maximum to the limit of posts you want to show in the related posts area.

Set the Thumbnail Image Size

The imageSize setting controls the thumbnail width and height. The image size you set here should not exceed the actual size of your post images. Just enter the size as a number, leave off the px.

Enable Round Thumbnails

Set the roundImages setting to true for round images in Chrome, Firefox, Safari, and the latest version of Internet Explorer.

Remove the Gallery Title

Set relatedTitle to false to remove the gallery title.

Remove the Label from the Title

The label that relates the posts in your gallery is added at the end of the gallery title by default. Set labelInTitle to false to remove it.

Change the Gallery Title

Change the text inside the quotation marks ("") for the relatedTitleText setting. Make sure to leave the quotation marks in place.

Add a Default Image

You can set a default image to show if some of your posts doesn't have images, an image fails to load, or your images are hosted on Flickr, Photobucket, or another non-Blogger host. Enter the direct link to your default image inside the quotation marks for the defaultImage setting. For best results, size the image to the width and height of your imageSize setting.

Enable Google Analytics Campaign Tracking

Set campaignTracking to true to enable Google Analytics campaign tracking. Then, fill in your source, medium, and name for your campaign between the quotation marks for the campaignSource, campaignMedium, and campaignName settings.

Change the Post Label Selector

Some custom templates give the post labels a different class than the one used by the default Blogger templates. You can change the selector with the postLabels setting. Find the class selector for your post labels and insert it after the dot inside the single quotes. If you need help finding the selector, check out my tutorial on finding CSS selectors, or check with the person who designed your template.

Change the Gallery's Insertion Point

If you're using a custom template that doesn't have the same features as a standard Blogger template, or you just want to put the gallery in another part of your post, you can change where the gallery is inserted with the insertBefore setting. Find the CSS selector for the div you'd like to place the gallery above and enter it between the single quotes for the insertBefore setting. Remember to include the dot (.) for class or hash/pound mark (#) for ID.

Back to Top

Introducing The Grab Button Builder

the grab button builder

Today I'm happy to introduce my newest project, The Grab Button Builder, a little web app that helps you build a grab button for your blog without writing any code at all.

The Grab Button Builder gives you the same grab button you'd get if you used my tutorial "Make an HTML Grab Button for Your Blog" — and just like that tutorial, the Builder won't give you any outdated markup. The button it builds for you works on Blogger, Wordpress.com & Wordpress.org, and Typepad.

Using the Builder

All you need to get started is a button image and a blog. Upload your button image to your favorite image host and grab the direct link to your image. If you don't know how to get your direct link, the Builder can show you how! Click on the image host tutorial for detailed instructions for the most popular image hosts.

grab button builder tutorial loader

By default the Builder will make the code box the same height as your button image and give it a gray border, a white background, and black text. But you can change those defaults if you like! Click the "Code Button Options" link to open up color and height settings for the code box.

Feedback

If you try The Grab Button Builder, I'd love to know what you think! Leave a comment, tweet at me on Twitter, or comment on Google+.

You Can Help!

I've posted the source code for the builder on GitHub to open it up to collaborators. If you've been thinking about dipping your toe into GitHub but haven't found the right project yet, please have a look at mine! I'd be very happy to collaborate with another developer or a designer to help make the button builder work better or look nicer.

If you have suggestions for improvements and would like to help out, open an issue through GitHub to get the ball rolling.

How to Use the Official Pin It Hover Buttons on Blogger

Updated 2014

Pin It Buttons for Blogger
Updated November 2014 to include screenshots and instructions for the newest version of the Pinterest code.

Pinterest's official hovering "Pin It" buttons have improved in 2014 — there are more button options, and they load faster than ever. And, in the year since I wrote my original tutorial, I've come up with a few new code snippets to help you control where the buttons appear on Blogger blogs. Since there's so much new stuff to tell you, it's time for a brand new tutorial. Let's get started!

What You'll Learn

This tutorial will show you how to add the official hovering Pin It buttons to your Blogger blog. The buttons will show up in the upper left corner of your post images when your readers hover over the images.

Compatibility

These buttons work on all Blogger templates except Dynamic Views, which doesn't accept customization. The buttons appear on images with a minimum width of 200px and a minimum height of 100px. Smaller images are skipped.

Get the Code

To get your own button code, go to the Pinterest Widget Builder (opens in a new window).

Make sure that the "Button Type" option is set to "Image Hover", then choose your favorite button style.

You get a choice of small or large rectangular buttons in gray, white, or red, or small or large round buttons in red. You can preview each button style to choose the right one for your blog.

Once you've chosen your button style, copy the code in the grey box below the preview image to your clipboard. The code will look similar to this:

Back Up Your Template

From your Blogger dashboard, go to "Template" and click the "Backup/Restore" button in the top right corner. Save the .xml file somewhere safe.

Next, open your template by clicking the "Edit HTML" button below your "Live On Blog" screenshot.

We're going to use the template search feature to search your code. Your browser's search function can't search the code, so be sure to follow these directions exactly.

  1. Place your cursor on the template code.
  2. Click once.
  3. Press CTRL and F at the same time (PC) or Command and F (Mac).

The search box will open in the upper right corner of the template editor.

Enter </body> in the search box, then press enter. The code will "jump" to the </body> tag in your template and highlight it in yellow.

Add the Code

Immediately above the </body> tag, enter the code you got from Pinterest.

Before you save your template, remove the words "async defer" from the code. This is important, your template will not save unless you remove the words "async defer".

Press the orange "Save Template" button up top to save your template. Then, go look at your blog. You should see the Pin It buttons you chose in the upper left corner of your images when you hover your cursor over each image. Nice, right?

Now, let's check out some more advanced things you can do to customize how the buttons work on your blog.

Advanced Options

Link "Homepage" Pins to the Right Post

If you do a lot of Pinterest browsing, you've probably had this happen to you: you click on a Pin for a recipe you want to try or an article you want to read, and end up on the home page of the blog, not the post you wanted to see! That happens when a reader Pins from the home page of a blog that doesn't have Pinterest's data-pin-url attribute on the images. You can add that to your blog with the code from this tutorial: Link Pinterest Pins to the Right Post on Blogger.

Remove the Button From Specific Post Images

If you want to take the Pin It button off of an image or two in a post or on a static page, you can use the "nopin" attribute. To "nopin" an image, switch over to the HTML view of your post or page, and find the img src HTML markup for the image you'd like to "nopin". It will look something like this:

HTML view of an image in Blogger

Enter nopin="nopin" right before the closing slash and angle bracket of your image element, like this:

When you save your post, the Pin It button will disappear from that image.

Remove the Buttons from a Group of Post Images

Sometimes you'll want to remove the Pin It button from a large group of images in a post or static page. After an initial setup, this method will let you "nopin" larger groups of images quickly.

First, back up your template! Then, open your template code by going to Template > Edit HTML. Find the </body> tag again, and enter the following bit of JavaScript directly above the </body> tag.


<script type="text/javascript">
var nopinimg = document.querySelectorAll('.nopin img');
 for(var i = 0; i &lt; nopinimg.length; i++) {
   nopinimg[i].setAttribute('nopin', 'nopin');
 }
</script>

Save your template. Nothing will change yet; this code is the foundation for the next bit of code you'll use.

Now, switch to the HTML editor of the post with the group of images, and find the code for the first photo in the group. It will look something like this:

Add this line immediately above that first image:


<div class="nopin">

Then, find the last image in the group. Its code will look very similar to the code for the first image. Immediately below the last image, enter this closing div tag:


</div>

Save your post, and the Pin It buttons will disappear from all of the images you wrapped in the div. The next time you want to "nopin" a bunch of images, just wrap them in the div; there's no need to re-install the JavaScript part of this code.

There's a shortcut if you want to remove the button from all of the images in a single post — just add the first div tag above the first line of your post, and the closing div tag below the last line of your post. All of the images inside that div will lose their buttons.

Remove the Pin It Button from the Header

If the Pin It button appears on your header and you'd like to remove it, you can do it with a little snippet of code!

First, back up your template again. Then, find the </body> tag again, and enter this code snippet directly above the tag, after your Pin It button code:


<script type="text/javascript">
document.getElementById("Header1_headerimg").setAttribute("nopin","nopin");
</script>

Save your template, and the Pin It button will disappear form your header.

Remove the Pin It Button from Sidebar Images

The Pin It button may appear on your sidebar images, too. If you'd prefer that it didn't, you can add the "nopin" attribute! There are two ways to do that, and the how-to depends on how you added the images to your blog.

HTML/JavaScript Gadget Images

For images in an HTML/JavaScript gadget, open your gadget and find the <img> element(s) in your gadget. Add nopin="nopin" right before the closing slash and angle bracket of your image element(s), like this:

Image Gadget Images

If you added your images through the Image gadget, you can add the nopin attribute through the template editor. It's a little trickier than the other methods in this post — if you're not familiar with the template editor, I recommend reading How to Use the New Blogger Template Editor first to get comfortable with how it works.

Before you edit your template, be sure to make a backup.

To find your image in your template, you'll need the widget ID for your image. To get it, go to your blog and hover your cursor over the wrench icon at the bottom of your image gadget. When you do that, you'll see a URL appear at the bottom of your browser window. Look for "widgetID=" in the URL. The widget ID will say "widgetID=ImageX", where X is the image ID number.

Once you have your template backed up and know your widget ID number, go to Template > Edit HTML and select your image by its widget ID from the "Jump to Widget" menu.

The template will jump to your image widget. Expand your widget's code by clicking the small black arrows at the left of the template editor, until the code is completely expanded.

Find this segment of the code:


<b:if cond='data:link != ""'>
        <a expr:href='data:link'>
          <img expr:alt='data:title' expr:height='data:height' expr:id='data:widget.instanceId + "_img"' expr:src='data:sourceUrl' expr:width='data:width'/>
        </a>
      <b:else/>
        <img expr:alt='data:title' expr:height='data:height' expr:id='data:widget.instanceId + "_img"' expr:src='data:sourceUrl' expr:width='data:width'/>
      </b:if>

Add nopin='nopin' immediately after 'data:width' in both places it appears in the code. When you're finished, the code should look like this:


<b:if cond='data:link != ""'>
        <a expr:href='data:link'>
          <img expr:alt='data:title' expr:height='data:height' expr:id='data:widget.instanceId + "_img"' expr:src='data:sourceUrl' expr:width='data:width' nopin='nopin'/>
        </a>
      <b:else/>
        <img expr:alt='data:title' expr:height='data:height' expr:id='data:widget.instanceId + "_img"' expr:src='data:sourceUrl' expr:width='data:width' nopin='nopin'/>
      </b:if>

Preview your template to make sure everything still looks the same before saving. If you get an error message or anything looks weird, press the "Revert Changes" button and start over. If everything looks good, press "Save" to apply your changes. When you go back to your published page, the sidebar pin it button will be gone!

Make Your Blog More Mobile-Friendly Without Redesigning

The mobile web is huge, and it's going to get bigger as people all over the world fall in love with smartphones. Now that so many people are browsing on small screens with data plans, a mobile-friendly blog helps you welcome a larger audience.

Lots of blogs are switching over to responsive or adaptive designs that scale and rearrange themselves depending on the size or type of the screen. But, redesign can be costly and time consuming. And, if you have fixed-placement arrangements with advertisers, you may feel like you're trapped in your current layout.

That doesn't mean there's nothing you can do to make your mobile readers happier!

If a full redesign isn't in the cards for you right now, there are adjustments you can make — ranging from tiny tweaks to more ambitious changes — that let you show your mobile readers some love without starting over from scratch. Today I'll give you some suggestions.

Reduce the Per-Page Post Count

This is by far the easiest tweak I'm going to cover today — it might only take you a few seconds!

Showing fewer posts per page reduces the load time & size of your home page and the index pages (the ones your readers reach using older & newer post links).

If you're on Blogger, you can adjust your posts-per-page under Settings > Posts and Comments > Posts > "Show at most".

On Wordpress, the setting is under Settings > Reading > "Blog pages show at most".

Say No to Popups

Real talk: people hate popup windows and popup overlays, and they hate them even more on mobile devices. Popups block the content, they're hard to dismiss on small screens, and they can slow down the load time. And I mean, come on — they're popups. They're annoying by design.

Mobile readers want to read your posts, but they don't want to struggle with closing a big popup window to do it. Keep your small-screen users in mind and ditch those popups!

Drop the Dropdowns

Or at the very least, test your dropdown menu(s) on mobile devices to see if they actually work. Unless your dropdown navigation was designed with mobile users in mind, it most likely relies on hover/mouseover events to create dropdown link lists. Those effects don't work the same on touchscreens as they do with a mouse.

Many dropdown menu styles that work smoothly on a computer frustrate touchscreen users with awkwardly-timed hover states and disappearing, unclickable links.

If your dropdown menu isn't compatible with mobile devices, consider streamlining your navigation to reduce or eliminate the need for dropdowns. A simple navigation layout is great for readers on any device, not just mobile users.

And, as an added side-benefit, simplified navigation can make it easier for search engines to crawl your blog. Give it some thought!

Limit Widgets & Gadgets

Widgets and gadgets, especially social media embeds and ads, can seriously bloat your blog and make it harder to load on mobile browsers. While you're getting mobile-friendly, take some time to reevaluate your widgets. Are they all earning their place on your blog?

Don't be afraid to experiment with removing widgets — you can always add them back! If you need help figuring out which widgets should get the boot, try out Pingdom's Website Speed Test. You can arrange the Pingdom results to show you which elements are taking the longest to load or have the largest filesize.

Enable an Alternate Mobile Template

You can "fake" a responsive design with an alternate template that only shows itself to readers on handheld devices. These templates let you leave your blog "as is" for computer screens, while radically optimizing the experience for mobile users. Mobile-only templates strip your blog down to its essence, hiding sidebars and most of the design elements. That means some or all of your sidebar ads will be hidden from mobile users.

Blogger has a built-in mobile template, and there are lots of plugin options for Wordpress — I'll show you my favorite!

Blogger's Mobile Template

Blogger's mobile template automatically sets mobile posts-per-page to 4. It also truncates all of your posts to the title, a thumbnail of the first image, and the first few sentences of your posts. If you use AdSense on your blog, up to two AdSense ads will appear — one at the top of your page and one at the bottom. Any other ads that show up in your regular design will not.

Blogger's mobile template is turned on by default, but if you've turned it off, it's easy to turn it back on. Go to Template and click the gear icon below the Mobile template. Set the radio button to "Yes. Show mobile template on mobile devices", then press the orange Save button.

Wordpress Mobile Plugins

For Wordpress users, I recommend WPTouch, a very slick mobile plugin with lots of customization options and features. And, like the Blogger mobile template, it supports AdSense! There's also a premium version with lots of sweet features. Complete installation instructions are available on the plugin page.

If WPTouch doesn't strike your fancy, there are plenty of other options available. WPMU has a great rundown of 8 excellent mobile plugin options.

Geometric Sidebar Menu with HTML and CSS

Today I'm going to show you how to make a geometric menu for your blog's sidebar using HTML and CSS, including a neat little CSS trick to create triangle points. Your menu will look something like the title image above. You can check out a live demo here.

If you're new to web development you may wonder why I'd make simple shapes like this with CSS instead of using images or image map. I prefer to use HTML & CSS instead of images whenever possible. Once you're comfortable with it, code is more flexible and simpler to maintain or update than images.

You can quickly add, remove, or rearrange items on an HTML menu with a couple of keystrokes — when you do, the height of the menu will adjust itself accordingly. And, you can change the menu's colors or font on a whim.

Limiting the images in your template also helps improve your blog's performance. Everybody likes a fast-loading blog!

Compatibility

You can use this tutorial to create a menu on any website that allows you to add custom HTML and CSS. Blogger, Typepad, and self-hosted Wordpress users, you're good to go. Wordpress.com users will need the premium Custom CSS add-on to add CSS.

The HTML

First things first, let's put together the HTML!

All of the code for this tutorial is in a CodePen demo. As you work, the demo will refresh itself so you know everything looks right before you add the code to your blog.

Click this link to open the CodePen demo in a new window.

In the CodePen demo, the HTML tab has all of the markup you need to get started. Don't worry if the colors and fonts aren't quite what you want — I'll show you how to edit them in the CSS section of this tutorial.

For now, all you need to do is fill in the links where prompted. For example, if I were using this menu on my blog, I'd change this:


 <a href="HOMEPAGE LINK HERE">Home</a>

To this:


<a href="http://www.codeitpretty.com">Home</a>

If you could use a more detailed explanation of how to write an HTML link, check out the "links" section of Practical HTML for Bloggers.

I've set up the demo with 7 links. Add or remove links as needed. If you need to add new links, make sure to keep them inside the triangles-menu div.

The CSS

Now let's move on to the CSS!

In the CodePen demo, the CSS tab is filled in with my styling for a 150px wide purple menu with a custom font, Alegreya Sans. Don't worry if that doesn't suit your blog — you'll be able to customize it!

Let's go through each CSS rule, so I can explain what each one does.


.point-top,
.point-bottom {
    width: 0;
    height: 0;
    border-right: 75px solid transparent;
    border-left: 75px solid transparent;
}        

Here I've set the width and height of both the top and bottom triangle points to 0. I've also added 75px wide transparent right and left borders to the triangle point divs. These invisible lines make the triangle shape happen.

The width of the left and right borders add up to 150px, the width of the menu.


.point-top {
  border-bottom: 50px solid rgb(177, 99, 163);
  border-top: 0; 
}

In the .point-top rule, I've given the div a bottom border that is 50px wide. This sets the color of the top triangle. The rgb number is for the shade of purple I'm using (radiant orchid — the color of the year). You can change that to another rgb color, a Hex color, or an X11 color name if you prefer.


.triangles-menu {
  background-color: rgb(177, 99, 163);
  width: 150px;
  padding-bottom: 1em;
}

In the .triangles-menu rule, I've set the background color for the menu area to the same purple as the top triangle. I've also given the menu a width of 150px, and padding at the bottom to add a little bit of blank space below the last link in the menu.

You can change the color, width, or padding to your liking. If you change the width of the menu, you'll need to adjust the width of the triangle's left and right borders in the ".point-top, .point-bottom" rule so that each border is equal to half the menu's total width.


.triangles-menu a {
  font-family: 'Alegreya Sans', sans-serif;
  font-weight: 100;
  font-size: 2em;
  color: white;
  display: block;
  text-align: center;
  text-decoration: none;
  margin-bottom: .5em;
}

The .triangle-menu a rule has a lot going on. In the first declaration, the links in the menu are set to display: block; which means that they'll all appear on their own line instead of running together (try removing the display: block; rule for a moment to see what I mean).

Next, I set the font-family to Alegreya Sans, a Google Web Font. If you'd like to use a Google Web Font for your menu design, you can learn how to add them to your template in this tutorial. If you don't want to use a custom font, you can remove the font-family declaration.

The font-weight and font-size declarations set the "boldness" of the text and the size, respectively. You can adjust those to suit your font choice, or remove them if you're not using a custom font.

The color rule sets the link's color to white. You can adjust that using another X11 color name, an rgb color, or a Hex color.

The text-align rule centers the text inside the menu container. The text-decoration removes the underline that appears by default under links in most browsers (we'll bring the underline back in a few cases in the next two rules).


.triangles-menu a:first-of-type { 
  padding-top: 1em;
  text-decoration: underline;
}

.triangles-menu a:hover {
  text-decoration: underline;
}

In these two rules, I'm using pseudo-classes to do a few special things to links in the menu. The first, for .triangles-menu a:first-of-type, gives the very first link in the menu a bit of padding at the top and a visible underline to differentiate it from the other links in the menu.

In the next rule, .triangle-menu a:hover, I'm bringing the underline back for each link when it's hovered.


.point-bottom {
  border-top: 50px solid rgb(177, 99, 163);
  border-bottom: 0;
}


This one looks familiar, doesn't it? This rule creates the bottom point. This time we're making an inverted triangle, so instead of a bottom border, we use a top border.

Adding Your Menu to Your Blog

Now that you've styled your menu, you're ready to add it to your blog! Let's add the CSS first so that your menu is instantly stylish when you add the HTML.

Add the CSS

In CodePen, copy all of the CSS from the CSS window and paste it into the custom CSS field for your blogging platform. If you're on Blogger, go to Template > Customize > Advanced > Add CSS. If you're on Typepad, go to Design > Custom CSS. On Wordpress your custom CSS location will vary. If you're using Jetpack's Custom CSS option, it's under Appearance > Edit CSS.

Save your CSS. Nothing will look different on your blog yet. You'll see the CSS working once you add the HTML.

Add the HTML

Next, copy everything from the HTML window and paste it into an HTML gadget/widget on your blog. On Blogger, use an HTML/JavaScript gadget. On Wordpress, enter it in a text widget. On Typepad, use the "Embed your own HTML" option in your Content menu.

Save your new widget and you should see your new menu appear in your sidebar. Nice work!

Make Your Own Tweetable Links for Blogger

DIY Tweet This links for Blogger

"Tweet This" links make it easy for your readers to share your posts on Twitter. And, with a little bit of code, it's pretty easy to make any text on your blog tweetable! Today I'm going to give you the tools to make click-to-Tweet links of your own.

What the Code Does

After a one-time setup, this code lets you make any sentence in your post tweetable in a few seconds. A link to your blog post is automatically added to the end of the Tweet. Here's a demo link, styled to match my blog with optional CSS I've included at the end of the tutorial:

I'm learning how to make click to Tweet links on #Blogger from @MMosley

The colors and Twitter icon are part of the CSS styling, and you can change them to suit your blog's style, or create a completely different design.

Compatibility

This works with all of the standard Blogger templates except Dynamic Views, which does not accept customization. This will also work with custom templates that have the same internal structure as a standard template.

For best results, make sure timestamp links are enabled for your blog (here's how to check). If you have timestamp links enabled, the tweet will include a link to your blog post at the end. If you don't, the tweet will link to the page your reader was on when they clicked the link. Often that's ok, but if your reader tweets from from your home page or an index page, visitors who click the link in the tweet may not end up on the right post.

All set? Let's get started!

Add the Twitter Code

If you already have the official Twitter timeline widget installed on your blog you can skip this step.

Twitter has a code snippet that makes your tweet links open a new, small Twitter window, like this:

To install it: first, back up your template (instructions here). Do not skip the backup.

Next, open your template by clicking the "Edit HTML" button below your "Live On Blog" screenshot.

Then, open your template's search box by placing your cursor over the code, clicking once, and pressing CTRL and F at the same time (PC) or Command and F (Mac).

Enter </body> in the search box, then press enter. The code will "jump" to the </body> tag in your template and highlight it in yellow.

Paste the following line of code immediately above the </body> tag:

<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>

Then, press the orange "Save Template" button. Nothing will change on your blog yet — that comes later!

Add the HTML/JavaScript Gadget

Now, let's add the jQuery that makes your links tweetable!

Go to Layout and click an "Add a Gadget" space.

Select HTML/JavaScript from the popup menu and insert the following code into the gadget:

Save the gadget. Nothing will change on your blog yet, but it will after the next step.

Make Tweetable Links

Now that you have the code installed, you can make any text on your blog a tweetable link! Make sure to pick sentences that are 117 characters or less to leave room for the link to your post at the end of the tweet.

To make text tweetable, switch to the HTML view of your post and find the text you want to twitterize.

Wrap the text in <p></p> paragraph tags, like this:

<p>This is my tweetable text. Click to tweet it!</p>

Then, add the class of "tweetable" to the opening paragraph tag, like this:

<p class="tweetable">This is my tweetable text. Click to tweet it!</p>

You can use blockquote or span elements if you prefer, but I'm using the paragraph element here because it's a good fit for most blogs.

Save your post and check it out on your blog. Your text is now tweetable! Click it and see how it works.

Style Your Tweetable Links

At this point your link will just look like a regular link — but you want it to stand out, right? That's where CSS comes in.

I put an editable demo of a styled "tweetable" link on Codepen. You can play with it to customize the colors and styling.

Note: the "tweetable" link inside the demo won't open a new window when you click it because it's hosted on Codepen. Don't worry, that's just a Codepen thing — the code from this tutorial will open a new window on Blogger.

<div class="post-outer">
  <a href="http://www.codeitpretty.com" class="timestamp-link"></a>
<p class="tweetable">I'm learning how to make tweetable links for #Blogger from @codeitpretty!</p>
</div>


See the Pen 6b71bca216f2c7eb6ed8c85e246cd482 by mariemosley (@mariemosley) on CodePen

When you have it styled the way you like it, copy everything in the CSS tab and paste it into your blog's CSS field (Template > Customize > Advanced > Add CSS). Press the orange "Apply to Blog" button to save your changes. Now all of your tweetable links will have style!

Until Next Year!

Can you believe this year is almost over? I can barely get my head around it.

This little note is my last post of 2013. From now until 2014, I'm taking some time to study, create, and write before I get back into a regular posting schedule.

Don't worry, I'll still be around to support my tutorials and answer questions in the comments! And, if you start to miss me, you can find me goofing off on Twitter, Google+, and Pinterest.

I wish you all the very happiest of holidays. See ya in 2014!

How to Show and Hide Blogger Sidebar Gadgets

how to show and hide gadgets in the Blogger sidebar

Blogger has a little-known power feature for template designers: conditional tags. With conditional tags, you can show or hide gadgets on specific pages of your blog — an option you can use in lots of creative ways.

Today I'm going to show you how to use conditional tags to show or hide sidebar gadgets on any page of your blog.

Compatibility

Conditional tags work with all of the standard Blogger templates except Dynamic Views, which doesn't accept customization. Some third-party templates may not accept conditional tags (but most do!).

The technique in this tutorial works on all gadget types except the "Google+ Badge" gadget and the old "Followers" (Google Friend Connect) gadget. You can hide those two gadgets using the instructions in this post's Appendix.

Difficulty

This tutorial is for beginners, but it's easiest if you have a little bit of experience with editing your Blogger template.

If you'd like to brush up on Blogger template basics first, check out How to Use the New Blogger Template Editor.

All set? Let's get started!

First, Back Up Your Template

Before you begin, back up your template (instructions here). Do not skip the backup.

Find Your Gadget in the Template

Open your template by clicking the "Edit HTML" button beneath your "Live on Blog" screenshot.

Now, use the "Jump to Widget" dropdown button to jump down to your gadget. In this example image, I'm choosing the widget with the ID "Image1".

jump to widget dropdown in Blogger

If you're not sure what your gadget's ID is, there's a quick way to find it.

While logged into Blogger, go to the main page of your blog and hover your cursor over the wrench icon at the bottom of your widget. When you do that, you'll see a URL appear at the bottom of your browser window in Firefox, Chrome, or Internet Explorer (Safari users will need to turn on the status bar under View > Show Status Bar).

Look for "Widget ID" in the URL.

The text between the equals sign in "WidgetID=" and the ampersand (&) is the widget's ID. Select that ID from the "Jump to Widget" menu to go straight to that widget's section in your blog's HTML.

Expand Your Widget

Now that you've found your widget, it's time to expand its code so you can insert the conditional tag.

Click the black arrows at the left of the widget's code to expand the code. Most widgets have at least one bit of code to unfold, some have 2 or 3. You can stop unfolding when you get to the closing </b:widget> tag of your widget and see that there are no more fold arrows above it.

Now that your code is unfolded, let me show you where to add the conditional tags.

Inserting Conditional Tags

No matter what conditional tag you choose, it goes in the same part of your gadget's code, so I'm going to show you placement first.

The opening conditional tag goes immediately below this line:

<b:includable id='main'>

The closing conditional tag, </b:if>, goes immediately above this line:

</b:includable>

Both lines are highlighted in this image:

Now that you know where to put your conditional, it's time to choose your tag!

Show Gadget on the Homepage Only

If you want to restrict a gadget to your homepage only, use this conditional.

Insert the following line below <b:includable id='main'>:

<b:if cond='data:blog.url == data:blog.homepageUrl'>

Then, close the conditional by inserting this line above </b:includable>:

</b:if>

Press the "Preview template" button. If you see an error message, double check your code and try again. Otherwise, press the "Save template" button to save your changes.

Show Gadget on the Homepage and "Index" Pages

The "Index" pages of your blog are the pages readers see when they click the "Older Posts" and "Newer Posts" links at the bottom of the page.

Insert the following line below <b:includable id='main'>:

<b:if cond='data:blog.pageType == "index"'>

Then, close the conditional by inserting this line above </b:includable>:

</b:if>

Press the "Preview template" button. If you see an error message, double check your code and try again. Otherwise, press the "Save template" button to save your changes.

Show Gadget on Post Pages Only

This will show the gadget only when your reader is on an individual post page (aka the permalink page). The gadget will be hidden from the home page, index pages, and static pages.

Insert the following line below <b:includable id='main'>:

<b:if cond='data:blog.pageType == "item"'>

Then, close the conditional by inserting this line above </b:includable>:

</b:if>

Press the "Preview template" button. If you see an error message, double check your code and try again. Otherwise, press the "Save template" button to save your changes.

Show Gadget on Static Pages Only

Static pages are the pages you make in the "Pages" section of Blogger — by default they show up in your top navigation, unless you've specified otherwise.

Insert the following line below <b:includable id='main'>:

<b:if cond='data:blog.pageType == "static_page"'>

Then, close the conditional by inserting this line above </b:includable>:

</b:if>

Press the "Preview template" button. If you see an error message, double check your code and try again. Otherwise, press the "Save template" button to save your changes.

Show Gadget on One Specific Page Only

This one's a bit of an oddball, but it could be handy! You can use a conditional to make a sidebar gadget appear one one specific page of your blog only, and nowhere else.

Note: I only recommend this conditional for blogs with custom domains. Blogs with .blogspot.com domains may have issues with this conditional on localized versions of the domain.

Insert the following line below <b:includable id='main'>:

<b:if cond='data:blog.url == "PAGE URL HERE"'>

Replace "Page URL here" with the address of the page that should show the gadget. So for example, if I only wanted to show the gadget on my resources page, I'd write it like this:

<b:if cond='data:blog.url == "www.codeitpretty.com/p/resources.html"'>

Then, close the conditional by inserting this line below above </b:includable>:

</b:if>

Press the "Preview template" button. If you see an error message, double check your code and try again. Otherwise, press the "Save template" button to save your changes.

Reversing Conditionals

So, what if you want to set the opposite version of a conditional? Say, for example, you want a gadget to show up everywhere except the home page?

In that case, you'd replace the == in the conditional with != like this:

<b:if cond='data:blog.url != data:blog.homepageUrl'>
(Gadget code here)
</b:if>

In this conditional, != stands for "is not", so you can think of the conditional as saying "if the URL is not the homepage URL, show the gadget".

Washi Tape Notes with HTML & CSS

Washi Tape Notes with HTML and CSS

Today I'm going to show you how to make a few paragraphs look like they were taped to your blog post with washi tape. Like this!

example of an HTML and CSS washi tape note in a blog post
click to enlarge screenshot

Tutorial Prerequisites

This tutorial is for advancing beginners. That's you if you've already done a few of my tutorials!

The prerequisites are:

  • Familiarity with your blog's HTML post editor
  • Understanding of where to put custom CSS in your blogging platform
  • Experience with uploading and linking to images
  • Understanding of HTML paragraphs

I'll take you step-by-step through the development process, but to really customize the note you'll need to do some of your own styling.

If you're experienced with HTML and CSS and would like to jump ahead to the code, I have a live, editable demo of this tutorial on Codepen.

"Materials" for This Tutorial

  1. A blog on a platform that allows you access to your posts' HTML and accepts custom CSS. Blogger, self-hosted Wordpress, and Typepad users, you're all set. Wordpress.com users will need the premium "Custom CSS" add-on to use CSS.
  2. Washi tape images for the corners of your "paper". Upload your washi tape images to your media library, the Picasa web album for your blog (for Blogger), or your favorite image hosting service, and take note of the direct URL to each image. You'll need that later in the tutorial.

In this demo, I'm using a tape image from Summer Patterns & Vectors by Tomodachi on Creative Market. There are tons of digital washi tapes available on Creative Market and Etsy (search "washi tape clip art" on Etsy to find the digital kind).

All set? Let's get started!

The HTML

First, switch over to the HTML editor for your post. On most blog platforms, that means clicking an "HTML" button or link at the top of your post editor.

Find the paragraph(s) you'd like to "stick" to your post with the washi tape. If they're not already wrapped in paragraph <p> </p> tags, wrap them, like this:

<p>This is a paragraph wrapped in paragraph tags.</p>
<p>This is a second paragraph, also wrapped in paragraph tags.</p>

Next, enter this immediately above the first paragraph:

<div class="tape-box">

Then, immediately below the last line of the last paragraph, enter this:

</div>

Your paragraphs are now wrapped in a div with the class of "tape-box", and should look like this:

<div class="tape-box">
<p>This is a paragraph wrapped in paragraph tags.</p>
<p>This is a second paragraph, also wrapped in paragraph tags.</p>
</div>

Next, add classes to the first and last paragraph inside the div. Give the first paragraph the class of "tape-first" and the last paragraph the class of "tape-last" (if you're only using one paragraph, give it both classes). Your paragraphs should now look like this:

<div class="tape-box">
<p class="tape-first">This is a paragraph wrapped in paragraph tags.</p>
<p class="tape-last">This is a second paragraph, also wrapped in paragraph tags.</p>
</div>

Or like this, for a single paragraph:

<div class="tape-box">
<p class="tape-first tape-last">This is only one paragraph wrapped in paragraph tags.</p>
</div>

That's all the HTML! Let's move on to the CSS.

The CSS

Here's where the style comes in! We're going to assign CSS rules to each of the classes we set up in the HTML.

If you'd like to try out the CSS before you add it to your blog, you can use my Codepen demo, or you can use Firefox's Style Editor to preview the CSS on your blog before adding it to your custom CSS.

When you're ready to apply it to your blog for real, enter the CSS that follows in the custom CSS area for your blogging platform.

Let's start by styling the tape-box div.

.tape-box {
  width: 450px;
  margin: 0 auto;
  position: relative;
  box-shadow: 0 4px 10px -5px rgba(0, 0, 0, .5);
}

In the .tape-box rule, I'm setting the width to 450px, centering with margin: 0 auto, and giving the div a box shadow to create the illusion of paper.

You can adjust the width and tweak the box shadow to suit your blog. If you'd prefer not to center the "paper", you can remove the margin rule or adjust it to your liking.

After adding this CSS, your box will look something like this:

minimally styled CSS box mimicking paper

Hardly inspiring, I know. It gets prettier!

Next, we get ready to apply the washi tape. Let's set up the basic, shared styling of the tape corners first:

.tape-box:before,
.tape-box:after {
  display: block;
  position: absolute;
}

Nothing will look different after you add that rule, it's just laying the groundwork for the next two rules. Now, let's add the tape!

 .tape-box:before {
   content: url(LEFT WASHI TAPE IMAGE URL HERE);
   left: -25px;
   top: -25px;
}

.tape-box:after {
  content: url(RIGHT WASHI TAPE IMAGE URL HERE);
  right: -25px;
  top: -25px;
}

Inside the parentheses after url, replace the text with the direct URL of your washi tape images. Then, adjust the left, right, and top positions of the tape images until you like where they're lined up with the top of the paper. The tape is probably overlapping your text at this point, but we'll tidy that up soon.

Let's style the paragraphs now.

.tape-box p {
  font-family: 'FONT NAME HERE', FALLBACK;
  color: #5c9a57;
  margin-left: 25px;
  font-size: 1.3em;
  padding: 0 1em;
}

In the .tape-box p rule, I've added a font-family declaration, which sets the font for the paragraph text. If you want your note to use the same font as the rest of your post, you can remove this declaration. Otherwise, replace FONT NAME HERE with the name of your first choice font, and replace FALLBACK with your fallback font choice. You can learn more about writing a font stack declaration in this post: Blog Font Style - Font Families.

I'm using the Google Web Font Kite One in the example. You can learn about adding Google Web Fonts to your blog in this post: How to Install Google Web Fonts on Your Blog.

I've also set the text color to a nice shade of green. Change that to the Hex color, RGB color, or X11 color name you prefer (more on finding web color values here).

The left margin, font size, and padding can be adjusted or removed to suit your blog's styling.

At this point, your sticky note is looking pretty cute, but kind of cramped. Your tape may be overlapping the text.

To give your text a little breathing room, let's style the .tape-first and .tape-last classes.

p.tape-first { 
  padding-top: 2em;
  text-indent: 1em;
}

p.tape-last { padding-bottom: 2em; }

Here we've selected the first and last paragraphs on your "paper", giving them a bit of padding at the top (for the first) and the bottom (for the last) to create some more space on the note. The text-indent in the first paragraph is just there because I like it; it's not essential and you should feel free to remove it.

You did it! Your taped note should now look something like this:

finished washi tape note

Using This Style on More Posts

One of the beautiful things about CSS is that after you've added it to your template, you can use it over and over again.

Once your washi note CSS is in your template, you can recreate the note in any post by wrapping paragraphs with the tape-box div and adding the tape-first and tape-last classes to the first and last paragraphs. You do not have to add the CSS again.

Your notes can vary in size and can get as long as you like — the "paper" will lengthen itself along with your text.

Why Is My Blogger Blog So Slow?

speed up Blogger: what to do when your blog slows down

We Blogger users are lucky because we don't have to worry about our hosting or our bandwidth. When was the last time your blog went down because you got too many visits at once? Never, right?

But, in my years working with Blogger users, I've seen that the bandwidth liberty can lead to carelessness when it comes to page weight. Since we don't have to concern ourselves with hosting limits like our fellow bloggers on other platforms, we often forget that we still need to keep our pages "light" so they load quickly. Overstuffed pages can lead to seriously sloooow load times.

In this post I'm going to cover the two most common reasons why Blogger blogs slow down, break them down finely, and help you figure out solutions.

It's Your Images

Images that aren't properly optimized for the web make your blog sluggish. One image with a large file size is rarely a problem, but there is a cumulative effect as you add more images.

Let's optimize all those images, starting from the top!

The Header

A heavy header can slow your page load time at the worst point — the very beginning. If your page isn't loading well right at the start, your readers are much more likely to bounce. Keep your header light!

The dimensions of the header aren't as important as the actual file size. Keep in mind, an image that looks small isn't necessarily small in file size. For example, check out these two images:

Code it Pretty logo

Logo: 350x208px, 47kb

pink rose

Rose: 150x200px, 90kb

Though the logo image is wider and taller, the rose image's file size is almost 2x as large.

Try to keep your header's file size under 50kb. If the header you love needs to lose a little weight, check out the links to image optimization tutorials coming up later in the post.

The Background

Ask yourself: do you even need a background image? Solid colors make beautiful backgrounds — in fact, solid colors are in right now as part of the flat design movement.

If a solid color doesn't do it for you, it's fine to use a background image with a small file size. I know that Blogger will let you upload a background image of up to 300kb, but realistically your background image size should be nowhere near that — try staying under 20kb to really make the browser happy!

Choose seamless repeatable background patterns over big images. For some examples (and free-to-use files) check out Subtlepatterns.com. Most of the images on Subtle Patterns are just a few kb in size. Some are so tiny they're measured in bytes!

And please, whatever you do, do not use one of those gigantic, full-page background images designed to create a "column" effect on your blog. The file sizes on those mega-backgrounds are huge — we're talking half-a-megabyte huge! That's way too much for the background.

Heavy Post Images

The photos in your post are awesome, no doubt. But, if they're not optimized for the web, they can have a negative impact on your page load time.

Photo optimization is a big topic I could talk about all day. Instead of actually doing that, let me link you to my three favorite tutorials:

"Prepping Images for the Web Using Photoshop and/or Preview" from developer Zoe Rooney's blog.

"10 Tips on Best Image Sizes for Your Blog" from One Dog Woof.

"Optimizing Images" from the Google Developers knowledgebase.

It's Your Gadgets & Ads

Many gadgets and ads contain content that is hosted on another server outside your blog. That content's "home" on the web can impact the load time of your blog.

One extreme example to illustrate the point is the big Facebook glitch that took giant chunks of the internet down with it in early 2013. Something like that is totally rare, and it's not a reason to avoid gadgets. But, it does demonstrate that a gadget with offsite content can impact your page's load time when something goes wrong at its source.

Even if your gadget isn't bringing in offsite content, it may still impact your page load time if it's poorly coded, or if it conflicts with other elements on your blog. This is common with custom code added through an HTML/JavaScript gadget.

The same goes for ads. I swear, this is not just me begin a jerk; Forbes magazine will tell you the same thing. Ads, especially too many ads, can slow your blog down.

Choose ads and ad networks judiciously. Don't cram your entire sidebar with ads. Even if your ads are flawlessly coded and served from the world's fastest server, adding too many will impact your page load.

And, though this doesn't have much to do with page speed, it's worth mentioning that search engines don't like excessive ads. Neither do your readers (though they may be too polite to tell you so).

Finding the Slow Gadgets & Ads

If you don't already know which of your gadgets or ads are slowing you down, there's a free online tool you can use to pinpoint them.

Use the Pingdom Website Speed Test to analyze your blog, then sort your results by load time.

If you find your gadgets or ads near the top of the results, cut the ones you can live without.

If even after you've pared down a bit you find that your ads are still a problem, get in touch with the ad's host (often your ad network, sometimes the advertiser themselves) and let them know that you're experiencing performance issues. They may be able to help!

Rose image CC-BY-SA T. Kiya via Flickr