March 25, 2013

Linux Sed Multiple Lines

Using sed to delete multiple lines from a file in linux

I remember how frustrating it was before I figured out the easy multiline sed command. This example is especially useful to clean up website hacks / injections - a "regular" single-line sed is fine to remove most of the common base64 injections that hit most of the files in the document root... But sometimes you come across JavaScript injections that are clearly "tagged" so there's an easy way to identify it in all injected files (even if there are 100,000+), but substituting part of the "signature" into your usual sed command just doesn't work.


Enter the multiline sed

There are two ways to do this, I'm going to go over the simpler one here, since if you are reading this, you probably need this information now:


Replace or remove multiple lines from a text file (the easy way):


sed '/FIRSTLINETODELETE/,/LASTLINETODELETE/d' /the/file/to/delete/from

*Lines can be regex, but make sure you get the whole line

Note: if you are cleaning script injections with a unique "tag" in the comment before and after the injection, just replace UNIQUETAG below with the random characters in the comment:


user@host [~]# sed '/<!--UNIQUETAG-->/,/<!--UNIQUETAG-->/d' /your/injected/file



This will output what the file will look like, but sed without -i will not modify the file.


If the output of the above looks correct, add -i after sed:


sed -i WILL modify the original file - please be sure your output is correct

sed -i '/<!--UNIQUETAG-->/,/<!--UNIQUETAG-->/d' /your/injected/file

"Regular" sed command, operates on a single line by default:

user@host [~]# sed 's/<!--UNIQUETAG.*UNIQUETAG-->//' /your/injected/file

This version will NOT work across multiple lines

Here's a test example that simulates an actual tag you may see in a javascript injection:

linux sed multi-line example command

*Note: I'm working in Centos but this should all work the same on most Linux distros. Also, for completeness' sake the other and "proper" way to do multi-line sed is the N option, which allows you to do much more complex tasks. This example deletes the last 2 lines of a file:

user@host [~]# sed 'N;$!P;$!D;$d' fileName

More multiline sed examples

In over your head? Call a Developer for help with Linux, servers, code, websites, and more. Let us worry about the tech stuff while you move your business forward.

Links


"Linux Sed Multiple Lines" continued here...

December 23, 2009

10 Tips for Web Designers to Ensure Client Satisfaction

Maybe you're in the small percentage of web designers who has never had a problem client, always turns everything in on time, and has never run into issues during a project. For the rest of you, these 10 tips for web designers will make your lives easier, whether you are just starting out in this field (or still in school), or you're a veteran web design ninja.



1. Set realistic goals, expectations, and deadlines


This one is probably the hardest for most web designers. We all want to say "Yeah, I can do that, it'll be awesomely high-tech, and it'll be done tomorrow." but the harsh reality is we often have many projects going, things come up, servers go down, and life sometimes gets in the way of our work (as does Internet Explorer...)


To avoid unhappy clients, overestimate your deadlines, downplay your design and coding skills, and be honest when you run into problems or things aren't happening on schedule. In general, underpromise and overdeliver to make your clients happy. They'll like you more if that new website has extra bells and whistles than if you have to leave things out that were on the project plan (or worse, the whole project is delayed).


2. Keep your files organized


Web designers and developers tend to have a million files of a thousand different types - HTML documents, CSS stylesheets, Javascripts, PHP files, database descriptions, keyword lists, sales copy, images, Flash files, and so on - that are all easy to lose track of. Which version of that default.css is most current? Why did I make this change? Where the %&*$ did I download those product images to?


To avoid a whole lot of hair-pulling, make a "Projects" folder on your local drive (if you don't have one, do it now, otherwise you'll forget), and make a separate client folder for each of your projects. I tend to use the domain name without the extension (so, for www.absurdhuman.com I have an "absurdhuman" folder in my Projects directory) which makes it pretty easy to track everything. Inside that folder, I usually keep the following folders:



  • info - a description of the project, relevant login information, client questionnaires with answers, contact info, and other information about the project. Scans of sketches, audio / video of client meetings, photos of whiteboard sessions, deployment checklists, proposals, and contracts (scan a signed copy!) can all go in here.

  • mockups - I keep my .psd or .jpg mockups separate. Once a client approves a specific design I usually move the selected mockup to /working/ so I can refer to it easily.

  • current - an up-to-date listing of the files deployed or ready to deploy, and nothing else. This is where minified Javascript and CSS, gzipped XML sitemaps, HTML with meta tags, and a current robots.txt file reside.

  • working - a whole mess of html, css, scripts, versioned by date and annotated with recent changes. This is the folder I work in.

  • backup - the most recent set of files I deem reasonable to keep a complete backup of

  • marketing - keyword lists, sales copy, banners, etc.

  • fromftp - I use this to download a backup of files before moving them to /working/ and working there. That way I can always revert to the last live site if I screw something up.

  • downloads - Mostly things sent by clients, including /images/ (usually uncropped large images from a digital camera that I need to edit before moving to working/images). I also keep software packages for a project (such as a gzipped recent download of jQuery or osCommerce) here before editing and moving to /working/.

  • testing - Sometimes I'll include this folder to try out major changes to a design before moving to /working/, this way I can also have /testing/layouts/abstract/ or /testing/jQuery/12082009/

  • snippets - I often find or write cool snippets of code or text that I want to incorporate into a project, but I'm not sure how or that part of the project is not done yet. I'll put text files of sales copy, code snippets, and even lists of images I'd like to use in here before putting it together in the working folder.


Feel free to modify this directory structure to your own design and coding needs, but the above is what I use and it helps me keep track of all 30+ projects I'm usually working on. Inside /working/ and /current/ you'll find the usual directories css, images, and scripts, as well as the planned directory structure of the actual site, which varies by project.


3. Backup!


You'd think I wouldn't have to list this here, but I've heard horror stories of accidental changes and deletions, and I've met many designers who can't tell me when the last backup was made of their Projects folder (if they have one). Back it up daily to an external hard drive or secure online virtual backup drive. Also make backups before you make major changes. Always knowing that you can "undo" changes from the last 10 minutes, few hours, or few days if necessary provides job security and peace of mind for a web designer.


4. Contracts are important


Most web designers don't have an MBA or a law degree, but contracts are the most important part of a web designers repertoire. If you don't have a lawyer, get a contract template online and have a lawyer look over your modified version of it. A good web design contract will include a project plan, provisions for payment, clauses for what happens if the client doesn't pay, copyright transfer information, and a whole lot more. This is what protects your digital assets, so for your pocketbook's sake, get a solid web design contract and use it with all of your clients (even friends and friends-of-friends).


5. Listen to your clients


Yes, web designers do crazy cool things with code and images that most people just don't understand, or even care to. But that doesn't work both ways. You, as the designer, have to take an interest in your client's business, their objectives, and their ideas. It is not your website, you are simply a glorified copywriter as far as most clients are concerned. Your job is to make their ideas shine on the Internet and present their information in a way that their clients and visitors will understand. If you don't listen very carefully, and ask the right questions, you will very likely end up with a problem client.


Examples of good questions to ask a potential or existing client:



  • Who buys / uses your product / service?

  • Who will be updating the website? Are they technically savvy?

  • Why do you want a website?

  • What is the primary goal of your website?

  • Do you want visitors from this city, this country, or all over the world?

  • What languages do your clients/buyers/potential site visitors speak?

  • Who are your biggest competitors? Do they have websites? Do you like any of them?

  • Are there any specific features you would like your website to have?

  • What colors do you like to see on other websites? What colors do you NOT want to see?


And many other similar questions. Take notes when they answer, do more research on your own based on their answers, then go back and ask some more questions. Only after that are you really ready to write a project plan and begin work on their new website - which will be exactly what they wanted if you listened carefully and asked enough questions.


6. Keep up with new technology


If technology advances quickly, the web is like a cheetah (or maybe more like a tasmanian devil) in a world of gazelles. Make it a part of your daily routine to check up on new technologies - Is that cool new software out of beta yet? Are there new versions of any of the libraries you usually use? What new web technology are people Twittering about?


Check up on your competitors - are they using CSS3 or HTML5 to enhance their sites, while you're stuck using transitional HTML4? How do they ensure their sites degrade nicely? Do they have any new tricks up their sleeves as far as animation, IE fixes, or backend programming (e.g. Ruby on Rails, Scala)? What did they add to their websites during recent updates?


Keep track of W3C standards and drafts - W3C compliance is one of your major web design goals, so go straight to the source and find out what you need to do now, and what you'll need to do in the future to make sure all of your websites are compliant.


7. Breathe


We all do it - you're on a code binge, so into your current project that before you know it, the sun's gone up and down twice, you haven't slept, you're out of coffee, and as you look over the last few hundred lines of code and text you wrote, you notice misspellings and mistakes everywhere.


Don't forget to take breaks during long design / code sessions, get some sleep regularly (ok, so sometimes a 15 minute walk has to suffice, but at least do that), and have someone else look over at least the text you've written before turning it over to a client.


Don't burn yourself out on a project - you are much more likely to make mistakes without ever noticing if you've been working for over 12 hours. If the deadline is tomorrow and you have to stay up all night to get it done, move the deadline and wake up early in the morning to work on the project. Trust me, the client will be happier with a well done website tomorrow than a website filled with poor grammar or bad code today.


8. Comment, comment, comment


In every language, including HTML and CSS, there is a semantic construct for adding comments to your code. It's there for a reason - please use comments liberally. Good comments are the difference between easily being able to re-design a site next year and having to start over from scratch. Add comments for things like: last modified, major changes, author, contact information, and description of this file at the beginning of each file. Then comment each section with what that section does, and add specific comments for anything that might not make sense to someone not familiar with your code (if you're not sure, comment it anyway).


9. If at first you don't succeed...


Don't get discouraged by failures, mistakes, or problem clients. Learn from your experiences, good and bad, and remember that there will always be other people and businesses who need websites. Every designer looks back at their early work and thinks "What was I doing?" - just know you will get better at design and dealing with clients with time, and keep doing what you do best. Someday you'll be able to hand-code fluid CSS layouts in your sleep. Until then, practice, practice, practice. Work on your own pet projects, build websites for friends, and go back to improve previous projects even if you never deploy your changes.



10. Have fun!



Design is fun, that's why we do what we do. None of us would deal with the crap we put up with if we didn't absolutely love making our clients happy, and showing off our cool designs and code. If design is not fun for you, try these tips and get organized. If you continue to experience frustration and just can't get ahead, take a few design classes or get a professional designer to mentor you for a while. Then build a few websites about subjects you are interested in for no other reason than to practice web design. If you're still not having fun, it may be time for a career change.


Happy designing!


Useful resources for web designers


Here is a list of websites, articles, and software packages I refer to and use regularly in my web design and development work:



Some more places to find useful SEO, web design, and web development resources:



My Twitter page often has more web design resource, so be sure to follow me to keep up with new web design tips and tutorials!



"10 Tips for Web Designers to Ensure Client Satisfaction" continued here...

April 13, 2009

Is Google Trying to Squash Twitter?

After hearing of the talks between Google and Twitter, I thought one of three things would happen: 1) Google makes an offer to buy Twitter; 2)Google buys, or re-develops Twitter Search; or 3) Google and Twitter work together, likely Google using a limitless Twitter API key to include real-time Twitter Search results. Well, I was very wrong. Google, being too big to fail and too powerful to care, decided to pick d) build an "enhanced" Twitter that gets Google even more data and control over the public. First the AdSense "enhanced" user tracking and targeting, then the "enhanced" local search results, and now:

Google Latitude - Twitter for Stalkers?

Google has released a service called Google Latitude that allows you to not only send "status messages" to your friends (sound familiar?) but also adds stalking - er, sorry, location-awareness capabilities:


Why does this bother me? Well, consider the sheer amount of your data that Google has - do you have a Gmail account? There's some. AdSense DoubleClick cookie? There's some more. And now, why not give them your cell phone number, location, picture, and directions to where you sleep? Even mainstream media is willing to admit that stalkers are a serious problem on Twitter, MySpace, and Facebook - how much better can it get when a stalker can use Google Latitude to get Google Maps and even directions to their target on their cell phone?

Also consider that Google's main moneymaker is advertising. They can already make certain types of ads "follow" you around the Internet with the new permanent AdSense cookies; Soon they will be able to change the billboards around you based on the number of people around that like Pepsi vs. Coke. Or worse. Google is clearly driven 100% by profit margin and the need to grow with no concern for privacy, safety, or freedom - just like our economy, our cars, and our egos.

How to UnGoogle Google:

  • Stop using Google services - no search, no maps, no AdWords, AdSense, Gmail, everything. Don't click or publish AdSense ads, get the anti-cookie. Whatever you do, avoid Google Latitude like the plague. Switch to competitors - yes, Google still has a few competitors left, and some of them make pretty good products. Start by giving some of these semantic search engines a try.

  • Talk and write about anything and everything you find about Google: blog, Tweet, text, email, write letters, call people - expose Google and what they are trying to do, and make people aware of the reasons to UnGoogle! (Hint: you can start by simply clicking the ShareThis button below!)

  • Start your own company - compete with Google! Especially in markets where Google is the only player. And this is the important part: Don't let Google buy you out! Google would never have gotten where it is without a lot of willing company builders that wanted a way to get rich and get out.

  • Finally - let Google know you are not happy! Tell Google technicians, sales reps, support people, executives, anyone - several people have left Google recently, and the company can only stand so much attrition before they lose power and control over the people.

Be careful out there - happy unGoogling!

"Is Google Trying to Squash Twitter?" continued here...

April 11, 2009

7 Features of Usable Apps

We use many applications these days, often simultaneously. No more web browser and email client, now we have multiple browsers, chat clients, social media widgets and toolbars and icons in the system tray - web apps and desktop apps and things in between, all pinging and chatting and tweeting and chirping. What makes an application practical, fun, and easy to use? Here are 7 features of a usable application:

Application Usability Tips

  1. Focus! What happens when you type the name of your favorite search engine into your address bar and press [Enter], then start typing? Input! Look at that! Put the first element on the page in focus to make your users happy. If you are developing a web application, here is a way to automatically put the first element in focus using jQuery.

  2. Labels. Be clear about what you expect from users and what they are getting in return. Data alone is meaningless without context - be sure to provide enough information to use the data presented, and make it clear what everything visible means.

  3. Icons. Don't assume your users know what the squiggly line with the hole in it means - use a standard set of icons, or at least explain what your icons do (use tooltips!).

  4. Tooltips. Again, at least some of your users might not know what "Reverse Proxy Address" means, so take a few minutes to add meaningful tooltips that pop up on mouseover for all of your form labels, icons, and anything else that may be even slightly ambiguous.

  5. Spacing. You may remember the days when all applications were presented as 80 (or 100) green characters on a black terminal. These days, your users may be using a screen size of a few inches or several feet, and you have hundreds of fonts to choose from. Keep the font readable, make sure elements are ordered and spaced in a logical manner, and keep the "eye flow" of the application in mind as you design to make your spacing user-friendly.

  6. Colors. What is the very first thing you notice about an application, or even a website? You may think it's the layout or the banner, but go to a website with bad colors and I think you will see what I mean. Choose a "soft" set of default colors, and maybe offer some wilder templates or skins.

  7. Choices. Users use applications to save time (whether they are successful is another story). Let them. I know this is tough, after all that thought about colors and spacing, but you have to let your users view their data how they choose. That means they can apply their favorite mauve/brown/khaki color scheme and make your pretty font so big it breaks your whole layout, then move all of the icons to the bottom right corner. Your application will not be "user-friendly" to all users, so let them change everything and avoid a lot of headaches down the road.
This is by no means an exhaustive list of application usability tips - and there are "recommended" features specific to web applications and desktop applications - but keeping these usability tips in mind as you design your next application will go a long way toward keeping your users happy!


"7 Features of Usable Apps" continued here...

April 9, 2009

5 Advanced Twitter Tips

I know, I should post more often - I've got requests for posts about RSS and some Twitter basics, but in true absurd human fashion, I will give you some juicy advanced Twitter tidbits (twidbits?) instead. If you need a basic overview of Twitter, please see Twitter Blog Marketing Tactics, leave a comment, or contact me directly. Please add your favorite advanced Twitter tips in the comments! Here are my top 5 Advanced Twitter Tips for Twitter Power Users, in no particular order:

  • Be retweetable. The best ways to do this are: 1) say something funny and somewhat random (keep it related to your "primary topic"), or b) bring the news - tweet breaking articles within a few hours of them being posted to get lots of retweets! Tip: leave really good tweets up overnight - remember how your latest tweet is in nice big attention-getting font? Great place to leave a joke, quote, tip or link to your awesome product/service for 6-12 hours (if you can stay away from Twitter that long).

  • Timing is everything. Morning in the US (or your local market) is a great time to Tweet, especially if you want people to act today. Based on some of my analytics, Twitter may be up to twice as "active" on weekends, so if you Tweet once a week, make it on Saturday.

  • Pay attention to your following. Try to follow most of the people you expect (want) to be your customers. Note things like tone (casual/professional), "style" (lots of RT's? Do they recommend or buy other products? What attracts them to people/products/companies?), what time of day their tweets are the most dense (hint: check the difference in timestamps of the first and last posts on your home page - closer together = good time to engage your followers).

  • Give stuff away, at the right time, to the right people. People are attracted to Twitter specials - try pre-releasing a product on Twitter, or giving a discount to your followers!

  • When you @reply, make at least some of your @replies such that anyone will benefit. An @reply can be a powerful recommendation for a product or service - just remember to add a description (e.g. Don't just say "This will work", say "Robo2112 widget will help you add that spark you need to your website")

  • DMs can help - or hurt - you significantly. DM's (and @replies) are the bread-and-butter of Twitter. Carefully crafted direct messages can create strong personal relationships and quickly convert a follower into a loyal follower, or even a paying client. I would recommend staying away from auto-DM's, at least until you are over, say, 100,000 followers. I do understand there is a point at which marketing this way makes sense, but while you have the ability to enjoy close reciprocal relationships with your most targeted followers, take that opportunity. Use the above tips to write powerful DM's that make your point in a concise and memorable way and you will be able to literally pick the clients you want to work with - a powerful edge in any industry!

  • Last but not least, timing is everything (paying attention?). By now you should have a target market of several specific niches and some understanding of your followers' Twitter habits (twabits). When they are online - DM them, @reply them, follow the people they are chatting with (who are also online and should follow you back), and follow some of their followers. Hint: Twitter followers are listed in chronological order by when they followed that user (most recent first). The first page of users, especially for popular users in your target niches, should be online currently - follow them to get more targeted followers.

Disclaimer: None of these techniques are likely to get you tens of thousands of followers in 90 days or whatever it is everyone is DM-ing around lately, nor will they shoot you to the top of the Twitter celebrities. These 5 advanced Twitter techniques may, however, help you use Twitter within your overall marketing strategy as an effective tool to build a community of close-knit, engaged followers who may become your best clients!

Bonus - Cool Free Twitter Tools!


  • Twitterator lets you follow a bunch of people at once

  • TweetCube lets you share files (<10MB) on Twitter for free! Remember the "give stuff away" tip? Here you go...

  • Twits Like Me helps you find people to follow who share some of your interests. Targeted marketing, and such.

  • If that's not enough Mashable has a list of over 140 Twitter tools

  • Last, there's the older Twitter Toolbox - some of these may no longer work, but there are still some good Twitter apps and tools there!

Happy Twittering and remember to Retweet!

UPDATE: Thanks to everyone tweeting this post!

@IgorFomichev @seanometer @MarjyMeechan @MonicaPortugfan @mabsmith @CodeSucker @zygbot @EdwinKersten @hsbcnews @julianpettit @TracyGazzard @twitme101 @AnthonyMcMurray @kdburnett @briankurtz @Marenda @foolsprogress @thewildjoker @Jan_Geronimo @fpalattao @mparent77772 @sillyaudrey @twitte_r_tips

Want to get even more Twitter followers? Just Tweet these 5 Twitter tips, and I will put your Twitter link on this page! Feel free to leave comments to remind me!


"5 Advanced Twitter Tips" continued here...

March 29, 2009

Twitter Blog Marketing Tactics

So you've chosen your topic, written some great content, and made a blog. Hopefully you used some of the blog SEO tips I discussed in my last post to get indexed and ranked for at least some of your target keywords. Maybe you're even starting to see some traffic trickle in, but... wouldn't it be great if you could send interested visitors to your blog as soon as you post? Even better, I'll show you blog marketing tactics that can get targeted visitors to come to your blog whenever you choose!

How to drive traffic to your blog using Twitter

First things first, you have to sign up for Twitter if you do not have an account. You can check out my Twitter profile here: absurd_human on Twitter. Now, here's the key - don't blindly follow people, even though some "pros" will tell you to do so. And definitely do not use any sort of autofollow tool. Find people relevant to what you are doing, and follow them. Be active with a good balance of @replies, direct messages, and public tweets. Try to restrict your Tweets to your area of expertise or the topic of your blog or site. If you are using Twitter as a personal tool to communicate with friends, you may want to create a separate Twitter account for your "brand" - even if it is just a small blog or website right now. Hint: find someone who is interested in the topic of your site (try a Twitter search) that follows say around 1,000 people, and look through the people they are following (not the people who follow them) for interesting people whose updates you might be interested in. Follow between 50 and 100 people per day, but don't let your ratio of followers / following get too out of hand.

How to get followers on Twitter

  • Make a bio! People generally skim follower lists, so they only see your bio as it pops up in the tooltip. Most people make their decision to follow people on Twitter based on just the image, username, and bio. If you have these three things, and they attract attention, you will get more followers.

  • Customize your Twitter page! This one is a little more difficult, but worth it. Check out my Twitter background. Spiffy, no? To upload your own, click "Settings"->"Design"->"Change Background Image" - make sure your image is large enough for most resolutions (1024px x 768px) or use the "tile" option

  • Post meaningful tweets, with a good balance as described above.

  • Retweet things you find truly interesting or funny, but don't go overboard.

  • Tweet the right amount: don't tweet every 3 seconds or every 3 months, somewhere in between should be good.

  • Offer something useful in exchange for following you: software, services, friendship, something of value.

  • Don't auto-anything. Scheduling tweets for later using Tweetlater is ok, but I don't think anyone really likes getting auto-DMs or spam

  • Make it easy for people to interact with you through Twitter: put a Twitter widget on your blog, add Tweetmeme buttons to your posts - they work!

  • Tweet your posts, but don't spam. It's ok to tweet about the same post later, but don't let your profile start to fill with only links to your own stuff.

  • Use cli.gs or another URL shortening service that comes with analytics. See what works and what doesn't!

Is marketing on Twitter worth the trouble?

You might think "Why don't I save myself all that time and just use PPC advertising to drive some quick traffic to my blog. That seems to work for all the marketing pros." Yes, PPC can give you targeted blog traffic (if you do your keyword research), and it should be a part of your overall marketing strategy. However, I would recommend waiting until you've made money from your free marketing efforts, then put that money into PPC marketing - that way you are not taking on any risk and have the luxury of being able to lose money finding the best PPC strategy for your site.

If you still don't think it is worth your time to build a targeted network of followers, consider the fact that a "good" CTR for Pay-Per-Click advertising is around 1-5%. Earlier this week, when I had a mere 100 Twitter followers, I sent out a link to my post about the new AdSense privacy policy requirements. Here are the results:


Twitter Marketing | 12 hits out of 100 followers

Notice the little pop-up box that says "12"? That's the number of hits on the first day I sent it out. So, just over 100 followers, 12 immediate clicks. 10% CTR. Ok, sure, I can get 10% on one link one day, you say... Good, you should be skeptical, especially about Internet marketing. Let's see what happens next.

I keep diligently finding Twitter followers who share my interests in technology, music, and above all, humanity. Friday I was over 600 followers. I sent out another link, this time to these blog SEO tips. Let's see what happened:


Twitter Marketing | 63 hits out of 600 followers

Again, notice the pop-up box: 63 hits the day I sent that link. 63 / 600 ~ 10% close enough for me to assume there could be a positive correlation (I know the Twitter box says 723 followers - I procrastinated a bit). Now, I obviously can't guarantee that you will get x% CTR or that people will buy from you if you market your blog on Twitter. What I can tell you is that this is one of my blog marketing tactics, and I'm seeing a consistent 10% click through ratio and gathering attentive readers who often become return visitors. If you follow the steps above, you will probably have a much smoother Twitter experience than if you choose the path of the "pro marketer" and use auto-follow tools and buy any Twitter marketing tool when it comes out.

Follow me and you just might build a super-targeted network of followers who share your interests, engage in meaningful discussions, and eagerly wait for you to show them the next cool new thing on Twitter!

Thanks for reading - Please ReTweet!

"Twitter Blog Marketing Tactics" continued here...

March 26, 2009

Blog SEO Tips

Here are a few neat blog SEO tips to help your blog rank a little higher in search engines. Why should you listen to me about blog SEO? Granted this blog is fairly new, and PageRank 0, but most of my posts get listed in Google for the keyword I want within minutes, and I am actually on the first page right now for "adsense privacy" and "adsense cookies" (depends on your browsing history now).

Now, it is not very difficult to get into the first page as a "recent" result, even without much SEO - these are blog posts and other news items within the last few hours that show up in Google search results. Try it - if you search Google for relevant news when it happens (try Googling a Twitter trend) you will see a few blogs and sites with lower "authority" but when you search for them a few hours later they will be lower. Often, these "fresh results" seem to completely drop out of the search results before going into the "main" index. Remember: now that Google uses your web history to refine results, you may need to clear cookies, clear web history, and change your Google search settings to see the "default" results, and you have less control over your position for your target keyword phrases in actual visitor searches.

Google "adsense privacy" - see my post about adsense privacy there on the first page? This blog was created in February of this year, it should not even be out of the sandbox - and is PageRank 0 still, but it is there on the front page. Want to know how I do it?


I generally start with the content - I'll pick a somewhat specific topic to write about (in this case the new adsense email), and I'll write the post. Then I go back and figure out how to market it. Occassionally, if I don't feel a particular inclination to write about something, I do use the Google Suggest (now built into Google front page) to pick a topic to write about. Either way, I almost always use this functionality to refine my keywords when I am finished with the post. How?

Simply go to the front page of Google (not inside of a search, or gmail, etc.) and start typing - see the list of words that pops up? Those are popular search terms that start with what you've typed (note: exactly what is in the box will not appear in the results). Look for words higher in the list - meaning more often searched, but with a lower number of results - meaning less competition. The less letters you type in (the more you can backspace) and still see your "target keyphrase" high in the list, the higher the "value" of the keyword. This does not mean you will get tons of traffic, it just means you will have an easier time getting to the front page of Google.

In the case of "adsense privacy" - it is a keyword that is not searched as often, but also has little competition, so I felt confident of my ability to rank. It does bring in some traffic, and I have a feeling people may start searching for it more after Google's deadline about the new AdSense privacy policy requirements on April 8. When I saw that my blog SEO ninja magic had worked, I decided to go for a keyword phrase with higher competition - "adsense privacy" has 7,000,000 results and shows up in the search suggestion list (unlike "adsense cookie"). And the blog SEO ninja magic works there too.

What is the blog SEO ninja magic?

  • Stay focused on the key phrase you picked. You may pick 2-5 key terms for your tags and blog post, but stay focused primarily on one of them.

  • Basic HTML blog SEO - when appropriate, use the acronym tag, h1 and h2 tags (hint: use CSS to make them smaller if they are too big!), bold and italics (through CSS styling, if possible), and link out with your primary keyword phrase as anchor text.

  • Optimize the post title - this might be the most important thing, as it also affects the permalink. Use your key phrase first, with something to draw your audience in (like "AdSense Privacy? - Need a New Ad Provider") and make it memorable. You will want to set your blog title to [key phrase] | [blog title] (with the | symbol as a separator) if your blog is relatively new also.

  • Valid HTML - Don't kill yourself over it, but try to take care of obvious errors. Run your post page through the keyword density tool and peruse the other fine free SEO tools at SEOChat

  • Tags or labels - these are the SEO goldmine of blogging, as long as you use them correctly. I see many bloggers stuffing the tags full of keywords and never using the same tag for different posts. Generally, you want to label posts with between 2 and 6 tags of 2 to 3 words each. Hint: use the Google search suggestions to find $$$ keywords, then use those as tags!

  • While we're on tags, how about some meta tags? Use those tags or labels as the meta keyword tag of that post, and make sure to add a meta description (usually the "teaser" part of the post, or make one up under 160 characters) and the title of the post as the meta title. Note: Blogger and Wordpress offer plugins to do this, but I would recommend doing it manually before using a plugin. You will want to tweak the results when you use a plugin, so you may as well learn to do on-page blog SEO from scratch.

    Update: I found a site that shows you how to optimize Blogger meta tags with the new Blogger templates.

  • Don't fall for the trap. Many people think "adsense cookie" and "adsense cookies" (and similar variations, tenses, etc.) are the "same" key phrase, because they are generally aggregated as such during a search. However, when you are trying to rank, there is a difference between these keyword phrases. There is also a difference between quad core laptop and quad-core laptop (dash vs. no dash) and many other search terms people might expect to be the same - you can often see this in the suggestion box e.g. number of results changes when you add an "s" at the end.

  • Pepper in related keywords - see the "search terms" and "keyword phrases" in the above bullet? I just went back to replace "these" and "terms" - making the post suddenly more relevant as far as Google is concerned, even though it did not really affect the readability to a human. Remember: write for humans first, then feed the robots what they need to see.

  • Sitemap - Good news! If you have an RSS feed, you can just use that as your sitemap. Just submit it to Google Webmaster Tools, follow the instructions to verify, and you will be that much closer to being indexed! You can also check your index stats from here. Don't forget to submit to Yahoo! and MSN also. (How to submit your sitemap.

  • Blogroll - This one is important; Get relevant bloggers and add their blogs to your blogroll. This increases how often your blog is 'updated', which will generally help the searchbots crawl your blog more often, and give you more "authority". As a side effect, many of those webmasters will also find your blog and link to you (It's ok to email them asking what they would like for the anchor text).

  • Then just contact people - webmasters of similar sites and blogs, people interested in the topic of your blog. Don't be afraid to ask for [primary keyword phrase] [Blog name] as anchor text (instead of just the blog name), or ask people to comment on posts or your site (please comment on my site and this post in the comment area below). Leave relevant comments where you can tie in your post (don't spam). Email, Twitter, Facebook, IM, etc. Promote your blog or site in person. The greatest thing is that these people already share some of your interests, so you are making lasting relationships rather than getting people on your site for a few minutes so they can click an ad that gets you maybe a few dollars.

  • Make it easy for visitors to share your blog with others - you don't want to waste all of that on-page blog SEO that you just did up there ^ (you are doing this stuff, right?) As an example, on your right you can see the user-friendly Tweetmeme, StumbleUpon, and Digg buttons, and below you will find the ShareThis button, which allows you to bookmark, blog, snip, buzz, and share this post just about anywhere on the 'net including Facebook, MySpace, Reddit, Sphinn, Mixx, and more - feel free to try them out and see how they work! If you need help getting these buttons working on your blog contact me.

That list of blog SEO tips should get you started, it might even get you to the first page of the search results (if it does remember who got you there!), and even if not you will have better ability to choose keywords and work them into your post. Let me know if anything is unclear, and please feel free to list other website and blog SEO tips that work for you in the comments.


Thanks for reading! Please share if you enjoyed these blog SEO tips.

"Blog SEO Tips" continued here...