Saturday, February 14, 2015

How to structure a Sass project

One of the most useful features of Sass is being able to separate your stylesheets into separate files. You can then use the @import directive to include the source of your individual files into one master stylesheet.
But how should you structure your Sass projects? Is there a standard way of separating out your CSS files?

Basic directory structure

I like to layout my Sass projects like this:
stylesheets/
|
|-- modules/              # Common modules
|   |-- _all.scss         # Include to get all modules
|   |-- _utility.scss     # Module name
|   |-- _colors.scss      # Etc...
|   ...
|
|-- partials/             # Partials
|   |-- _base.sass        # imports for all mixins + global project variables
|   |-- _buttons.scss     # buttons
|   |-- _figures.scss     # figures
|   |-- _grids.scss       # grids
|   |-- _typography.scss  # typography
|   |-- _reset.scss       # reset
|   ...
|
|-- vendor/               # CSS or Sass from other projects
|   |-- _colorpicker.scss
|   |-- _jquery.ui.core.scss
|   ...
|
`-- main.scss            # primary Sass file

Primary stylesheet

This allows me to keep my primary Sass file extremely clean:
// Modules and Variables
@import "partials/base";

// Partials
@import "partials/reset";
@import "partials/typography";
@import "partials/buttons";
@import "partials/figures";
@import "partials/grids";
// ...

// Third-party
@import "vendor/colorpicker";
@import "vendor/jquery.ui.core";

Modules, partials, and vendor

As you can see this divides my project into three basic types of files. Modules, partials, and vendored stylesheets.
  • The modules directory is reserved for Sass code that doesn't cause Sass to actually output CSS. Things like mixin declarations, functions, and variables.
  • The partials directory is where the meat of my CSS is constructed. A lot of folks like to break their stylesheets into header, content, sidebar, and footer components (and a few others). As I'm more of a SMACSS guy myself, I like to break things down into much finer categories (typography, buttons, textboxes, selectboxes, etc…).
  • The vendor directory is for third-party CSS. This is handy when using prepackaged components developed by other people (or for your own components that are maintained in another project). jQuery UI and a color picker are examples of CSS that you might want to place in the vendor directory. As a general rule I make it a point not to modify files in my vendor directory. If I need to make modifications I add those after the vendored files are included in my primary stylesheet. This should make it easy for me to update my third-party stylesheets to more current versions in the future.

Using a base partial

In my partials directory you will also notice that I have a base partial. The purpose of this partial is to load up my Sass environment so that it's easy to construct a stylesheet.
It might look something like this:
// Use Compass ('cause it rocks!)
@import "compass";

// Font weights
$light: 100;
$regular: 400;
$bold: 600;

// Base Font
$base-font-family: sans-serif;
$base-font-weight: $regular;
$base-font-size: 13px;
$base-line-height: 1.4;

// Fixed Font
$fixed-font-family: monospace;
$fixed-font-size: 85%;
$fixed-line-height: $base-line-height;

// Headings
$header-font-weight: $bold;

@import "modules/all";
The base stylesheet sets a couple of global variables and loads up all of my Sass modules. Again modules are not allowed to contain anything that would cause CSS output when importing. Tying all of my variables and modules up into a base partial gives me access to my entire Sass environment whenever I'm setting up a new stylesheet with a single import statement. This allows me to build multiple stylesheets by importing different partials. Multiple stylesheets are handy once a project grows to a certain size.

One step further

At UserVoice we take this pattern one step further. Since we have multiple sub-projects all bundled together in a single Rails app, we bundle each sub-project into a separate top-level directory. Our stylesheet directory looks more like this:
stylesheets/
|
|-- admin/           # Admin sub-project
|   |-- modules/
|   |-- partials/
|   `-- _base.scss
|
|-- account/         # Account sub-project
|   |-- modules/
|   |-- partials/
|   `-- _base.scss
|
|-- site/            # Site sub-project
|   |-- modules/
|   |-- partials/
|   `-- _base.scss
|
|-- vendor/          # CSS or Sass from other projects
|   |-- _colorpicker-1.1.scss
|   |-- _jquery.ui.core-1.9.1.scss
|   ...
|
|-- admin.scss       # Primary stylesheets for each project
|-- account.scss
`-- site.scss
As you can see each sub-project has it's own primary stylesheet, modules, partials, and base. Vendored stylesheets are typically versioned and have their own top-level directory. This is a handy pattern to use on very large Sass projects.

Further exploration

Now that I've laid out my own method for this, you may want to explore how other people have structured their Sass projects. There's actually a lot of variation in what you can do here. And some methods may work better on different projects:
Also check out Dale Sande's excellent article, Clean out your Sass junk drawer.
  ~ Beginner, Guides and Tutorials, John W. Long

Saturday, February 7, 2015

What is Bootstrap?


  • Bootstrap is a free front-end framework for faster and easier web development
  • Bootstrap includes HTML and CSS based design templates for typography, forms, buttons, tables, navigation, modals, image carousels and many other, as well as optional JavaScript plugins
  • Bootstrap also gives you the ability to easily create responsive designs
Note What is Responsive Web Design?
Responsive web design is about creating web sites which automatically adjust themselves to look good on all devices, from small phones to large desktops.

Bootstrap History

Bootstrap was developed by Mark Otto and Jacob Thornton at Twitter, and released as an open source product in August 2011 on GitHub.
In June 2014 Bootstrap was the No.1 project on GitHub!

Why Use Bootstrap?

Advantages of Bootstrap:
  • Easy to use: Anybody with just basic knowledge of HTML and CSS can start using Bootstrap
  • Responsive features: Bootstrap's responsive CSS adjusts to phones, tablets, and desktops
  • Mobile-first approach: In Bootstrap 3, mobile-first styles are part of the core framework
  • Browser compatibility: Bootstrap is compatible with all modern browsers (Chrome, Firefox, Internet Explorer, Safari, and Opera)

Where to Get Bootstrap?

There are two ways to start using Bootstrap on your own web site.
You can:
  • Download Bootstrap from getbootstrap.com
  • Include Bootstrap from a CDN

Downloading Bootstrap

If you want to download and host Bootstrap yourself, go to getbootstrap.com, and follow the instructions there.

Bootstrap CDN

If you don't want to download and host Bootstrap yourself, you can include it from a CDN (Content Delivery Network).
MaxCDN provide CDN support for Bootstrap's CSS and JavaScript. Also include jQuery:

MaxCDN:

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
Note One advantage of using the Bootstrap CDN:
Many users already have downloaded Bootstrap from MaxCDN when visiting another site. As a result, it will be loaded from cache when they visit your site, which leads to faster loading time. Also, most CDN's will make sure that once a user requests a file from it, it will be served from the server closest to them, which also leads to faster loading time.

Create First Web Page With Bootstrap

1. Add the HTML5 doctype
Bootstrap uses HTML elements and CSS properties that require the HTML5 doctype.
Always include the HTML5 doctype at the beginning of the page, along with the lang attribute and the correct character set:
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
  </head>
</html>
2. Bootstrap 3 is mobile-first
 Bootstrap 3 is designed to be responsive to mobile devices. Mobile-first styles are part of the core framework.
To ensure proper rendering and touch zooming, add the following <meta> tag inside the <head> element:
<meta name="viewport" content="width=device-width, initial-scale=1">
The width=device-width part sets the width of the page to follow the screen-width of the device (which will vary depending on the device).
The initial-scale=1 part sets the initial zoom level when the page is first loaded by the browser.
3. Containers
Bootstrap also requires a containing element to wrap site contents.
There are two container classes to choose from:
  1. The .container class provides a responsive fixed width container
  2. The .container-fluid class provides a full width container, spanning the entire width of the viewport
Note: Containers are not nestable (you cannot put a container inside another container).

Two Basic Bootstrap Pages

The following example shows the code for a basic Bootstrap page (with a responsive fixed width container):

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h1>My First Bootstrap Page</h1>
  <p>This is some text.</p>
</div>

</body>
</html>

Try it Yourself »
The following example shows the code for a basic Bootstrap page (with a full width container):

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container-fluid">
  <h1>My First Bootstrap Page</h1>
  <p>This is some text.</p>
</div>

</body>
</html>
</div>
 
Source: W3Schools.com

Wednesday, February 4, 2015

3 SEO Tests You Can Set Up Today to Give You the Edge in SERPs

from Griffin Roer

When it comes to website design and messaging, nearly everything you read encourages testing. You don’t generally see the same enthusiasm for experimentation in SEO. Why is that?
If you believe all that you read, optimizing for search can lead you down a path of appeasing Google’s guidelines, rather than creatively finding ways to increase visibility in SERPs.
seo steps to help you give the edge in serps
SEOs too often take what Google’s Webspam team and authoritative blogs broadcast at face value and optimize to “best practices” accordingly. I’ll admit that I’ve been guilty of drinking the Kool-Aid plenty of times without doing any critical examination.
I think Bill Sebald of Greenlane Search Marketing sums up my point best:
stop lazy seo
The truth is, without testing you can’t know definitively what works and what doesn’t. In a world where many SEO strategies have shifted focus to pure content creation, it may be your unique insight from consistent testing and tweaking that gives you the edge in SERPs.
The remainder of this post will give you ideas to test while citing interesting outcomes of search experiments and case studies to get you started down the road of SEO experimentation.

Set Up a Testing Environment

Unless organic traffic and search rankings aren’t important to your web presence, it’s best to set up one or several websites on which to test your SEO hypotheses.
If you own any now-dormant domains, they may be perfect candidates for revival as a test website. Otherwise, you can quickly and cheaply register a new one and spin up a WordPress site.
The tests themselves can be created and measured with this simple procedure:
  1. Create a control page that targets a specific search query. It’s a good idea to target a low volume, low competition search term or you can make up your own word, like “zizzantyx”.
  2. Spin up nearly-identical duplicate pages that vary by a single factor.
  3. Monitor the crawling and indexing of these pages over 10 or more days and watch for which ones outrank others.

test domains

Test #1: What Does a Perfectly Optimized Page Really Look Like?

The visibility of your great content is likely to be affected by its level of on-page optimization. But which elements have the greatest impact and how should they be implemented on a web page?
Your on-page SEO checklist likely addresses the following:
  • Title tag and meta description
  • Heading tags
  • Body text
  • Internal links and external links
  • Page URL
  • Image title and ALT text
  • Additional markup
You should test not only the usage of specific on-page elements, but also their location in the context of the page and positioning of the keyword within the elements themselves.
Testing “Old School” SEO Tactics
Bill Sebald of Greenlane Search Marketing tested several “old school” SEO tactics against one of his monitored keywords, “philadelphia seo company”. His tests improved his rank by three positions and he found that:
  • Exact match anchor text from a single page that passes PageRank still has an impact
  • A sitewide link with exact match anchor text actually hurt his rank
Bill also tested his title tags to see if length or keyword position would make a positive impact. It didn’t. Best to stick with relevant title tags with the goal of providing a good user experience, he concluded.
The Best Performing Anchor Link is One You Aren’t Using
Dan Petrovic, known experimenter with Dejan SEO, ran a similar anchor link test comparing four different styles of exact match anchor text. Interestingly, the winner was a page linked to by an image with ALT text containing the target keyword.
anchor links testing
Additional On-Page SEO Testing Ideas
  • Which elements are best to optimize for location-specific keywords to to make the biggest impact on local search results?
  • Does schema markup of a business’ name, address and phone number impact a site’s ranking ability?

Test #2: What is the SEO Value of Low-Quality Backlinks?

Backlinks are an SEO’s most loved and feared ranking factor. While the strong signal of a quality backlink can greatly improve search visibility, the murky classification of poor backlinks and their potential downside lead many to stay away from link building altogether.
matt cutts quote
Thanks for clearing that up for us, Matt.
However, if you’ve ever done a competitive audit of high-ranking sites in SERPs, you’ve definitely run across some suspicious backlink profiles. This can be especially frustrating for those of us that are focusing on white hat SEO tactics, yet are finding lower quality sites appearing above us.
Google’s definition of unnatural links covers a variety of linking scenarios. Some of the most frequently cited are:
  • Quid pro quo link exchanges
  • Buying or selling links
  • Automated link building
  • Low-quality directory or bookmark sites
  • Widely distributed links in headers, footers or widgets
  • Links in forum comments
Although having these types of backlinks can expose a website to algorithmic or manual penalty, that doesn’t necessarily mean they can’t positively impact search rankings.
Nofollow Backlinks Do Have SEO Value
Conventional SEO wisdom says that nofollow links do not impact your standing in search results. However, Rand Fishkin of Moz found that they did.
Rand ran multiple tests in which they built in-content nofollow links from more than 40 domains. After the links were indexed, the target web page’s ranking improved by one to three positions.
Need further proof? Even though nofollow links do not pass PageRank, according to Google, they have said that they will take action against sites that pursue mass nofollow linking. I would speculate that this is, at least in part, due to the ability of nofollow links to impact search results.
Rand’s backlink experimentation had an interesting and unexpected side effect. Months after removing the backlinks, their rankings continued to climb. Some pages went as high as #1! This was attributed to a phenomenon called link echos, whereby disappearing links don’t correspond with a drop in rankings.
website ranking
Black Hat Backlink Strategies Are Still Working (Temporarily)
It’s the most widely-known secret of the search industry. SEOs are constantly finding and sharing examples of black hat link building leading to dominance in search results. Despite Google’s stern warnings, it appears that their capacity to detect and clean up affected SERPs isn’t quite at the level that they lead us to believe.
Matthew Barby, a digital strategist at Wyatt International, uncovered a startling example of black hat SEO at work. The offending site was able to outrank industry leaders for the term “seo new york” in just three months using spammy backlinks. Although the publicity doomed them, they were likely generating thousands of unique visitors and plenty of leads during their reign.
matthew barby black hat seo work
More recently I conducted a backlink analysis on behalf of a local client seeking to rank for a Minneapolis-related keyword. On the one hand, there were a few well-established businesses with quality backlinks acquired through legitimate content marketing and PR. Above them ranked a newer competitor whose backlink profile was almost entirely comprised of low-quality directory sites with exact match anchor text.
exact match anchor text
Noted local SEO expert Mike Ramsey has lamented that with the introduction of Pigeon, “spam works better than ever” when it comes to inflating local search results.
The black hat approach to link building, in most cases, produces short term results. Rankings are boosted for several months before dropping. Although the gains are short-lived, the temporarily lift is enough to produce ROI for some. Unfortunately. this means that spammy link building will continue to influence SERPs.
Additional Backlink Testing Ideas
  • How many low-quality backlinks does it take to compete with one high quality backlink (yep, I’m testing that)?
  • Do exact match anchor links from press release sites still provide SEO value?

Test #3: Get Yourself a Manual Penalty

A manual penalty from the all-powerful Google seems like the most ominous threat to an SEO’s livelihood. It can obliterate your rankings and drop your organic traffic to zero. The reality? It’s not that bad.
In most cases, they don’t cause a total loss of rankings and traffic, but rather a demotion. While there are plenty of horror stories of Google’s Webspam team not replying to reconsideration requests, it usually takes anywhere from a couple days to a couple months for the penalty to be removed.
If you’ve never experienced a manual penalty for yourself, use your testing environment to give it a try. You’ll learn the cleanup and review process firsthand and be able use that knowledge to address a real penalty if you ever incur one.
You may find that a manual penalty is harder to come by than you think. But if you follow the suggestions above, you’ll eventually get this notice in Google Webmaster Tools.
webmaster tools
There are plenty of guidesfirst-hand accounts and step-by-step tutorials on diagnosing and recovering from a manual penalty that will help you through the process.
You Should Be Concerned About Negative SEO
Yonatan Dotan, head of SEO at yellowHEAD, recently had to help a client through a scary manual penalty. Overnight, they lost 94% of their organic traffic, including traffic from branded terms.
The client got caught in the crossfire of spammers trying to build links to their own sites. They sneakily included links to legitimate sites in an attempt to fool Google into thinking that the backlinks were originating from a quality source.
Yonatan points out that, although his client’s penalty was coincidental, if their client had been specifically targeted in this link scheme, the offenders would have successfully knocked them out of search results.
Google, up to this point, has acknowledged search professionals’ concerns over negative SEO, but will only say that algorithm updates continue to lower the risk without going into specifics.
Thankfully, the yellowHEAD team was able to recover 82% of their client’s organic traffic after waiting a month to hear from Google. However, the question remains: If you can intentionally earn yourself a manual penalty, why couldn’t you repeat the same process for a website that you don’t own? Perhaps your testing will give us all some insight.
Additional Manual Penalty Testing Ideas
  • Which tactic on it’s own is most likely to get noticed and cause a manual penalty? Well known link-networks, hidden text, links from penalized sites, or blog comment spamming?
  • How long does it take for disavowed backlinks to disappear from your backlink profile?
Conclusion
Go forth and test SEO conventions. Look at all claims with a degree of skepticism and confirm or deny them through your own testing process.
Most importantly, share what you find. Results from your experiments may help the SEO community uncover or support new trends, algorithm changes, and more.