To write appealing text for your audience, you need to know them. Who are those people that read your stories? Who are the people that search for the terms you want to be found for? Where do they come from? How old are they? What are they interested in? And how will you be able to reach those people again? In this post I’ll help you with analyzing your audience, as this is essential for SEO.

Why should I analyze my audience?

If you don’t know much about your audience, it can be quite hard to write texts for them. Should you write texts that are difficult or very easy to read? Which topics will interest them the most? Which search terms do they use? What blogpost will make them come back to your site? These questions are especially important if you want your audience to become regular visitors of your website or if you want them to buy something in your online shop. If you know a lot about your audience, it will be much easier to adapt your texts to your audience. As a result, you’ll become more successful in selling your stuff and gaining those return visitors. 

Learn how to write awesome and SEO friendly articles in our SEO Copywriting training »

SEO copywriting training$ 199 - Buy now » Info

How do I analyze my audience?

There are several ways of analyzing your audience. We’ve listed the ones we like to use below. To really get to know the people who come to your website, we’d advise to use all these different ways of analyzing.

1. Google Analytics

The best way to start analyzing your audience is by using Google Analytics. Google Analytics will tell you at what time a day your audience is on your site; where they’re from (at least from which country); which pages they like most and whether they use a desktop or a mobile device. That’s all valuable and usable information.

Closely monitor which pages and blog post generate much traffic and investigate possible patterns. Perhaps posts about a certain topic generate a lot of traffic, while posts about other topics don’t get many visitors. Use that information when choosing the topic of your next blog post.

2. Facebook Insights

Google Analytics can tell you a lot about the visitors on your website, but if you want to know more about the people you reach on Facebook you’ll need to use Facebook Insights. Check which posts get many views and which posts don’t get attention from your audience. Experiment with buying adds on Facebook too. Read all about Facebook Insights in Michiel’s post. Of course, every social media platform has its own analytics (we’ve also written about YouTube Analytics, Twitter Analytics and Pinterest Analytics). Monitor the analytics of the channels you use on a regular basis.

3. Surveys

A great way of getting to know your audience is to have them fill out an online questionnaire. In a survey, you can ask them anything you want.  You can, for instance, set up a survey that pops up when someone enters your site or you can send a survey invitation to your newsletter subscribers or to the buyers of your products. There are lots of packages that allow for online questionnaires. We have used Polldaddy.com in the past. They offer a free account, which will suffice for most small companies. What I really like about Polldaddy is the way they instantly present their results. They show frequencies and percentages in an easy to grasp format.

Remember that most people do not participate in online surveys. Still, if your audience is large, you’ll easily get a decent amount of people to fill out your questionnaire. To get more participants you can always try to win them over by raffling a nice incentive among the respondents.

Please note that it’s always a certain group of people that’ll be willing to fill out a survey. That group is highly selective and not representative for your entire audience.

4. Talking to your audience

Just having a conversation with a part of your audience also remains a great way to find out more about them. In an online questionnaire, you can ask a lot of people about your product, but their answers will probably remain shallow. If you’re able to really talk to some of the people from your audience in person, that could help you to get a better idea about who your audience are. Ask them what they like best about your website, your products, or your blog posts. Ask them why they come back to your website. Invite them to talk about their experience and don’t be scared of some criticism.

If I’m at a WordCamp or a congres somewhere and I encounter people using our Yoast SEO plugin, I always like to ask them what they appreciate most about our product. It helps me to understand our users. And, by understanding our users, we’re better able to anticipate upon their needs. If we know which features in Yoast SEO they like best, we should optimize or expand those features for sure.

5. Comments

If you want to analyze your audience and find out what kind of people it consists of, you should analyze the comments on your blogpost. What are people saying about you or about your post in the comments below your articles? Which aspects of your blog post are they talking about in their comments? Which topics are so important to them, that they are willing to engage? Analyze comments on your website, and don’t forget to monitor comments on social media either!

Learn how to set up a keyword strategy for your site in our Keyword research training »

Keyword research training$ 99 - Buy now » Info

Conclusion: analyzing is hard

Analyzing your audience can be a tough nut to crack. Google Analytics and the analytic tools of the numerous social media platforms are useful, but don’t tell much about the intentions or desires of your audiences. Surveys are great, but as most people won’t fill out an online questionnaire, the data aren’t that valid and representative for your entire audience. Talking to your audience can bring useful insights, but you won’t be able to have a conversation with all of them either.

All the different ways of analyzing your audience do add value in their own way though. Using them all will give you a clear impression of your audience.

Read more: ‘SEO copywriting: the ultimate guide’ »

Social media endeavors should be a part of your SEO strategy. As social media usage increased in popularity, Google and other search engines couldn’t ignore them any longer. This means that your site’s popularity on social media ties in with your SEO more and more. The reason for this is simple: if people talk about you, online or offline, you’re relevant to the topic at hand. In addition to that, you’ll want to know about these conversations. In this post, I’ll give you some fundamental tips on how to use social media.

How to use social media

Below are some tips you can use in order to set up or to improve your social media strategy:

1. Keep your account alive

The most crucial advice in the use of social media is that you need to keep your account ‘alive’. Make sure you post on a regular basis. Sharing your new blog posts is a good start, but also let people know what you’re working on or what interests you. If you go on vacation, schedule posts for the time you are away, or at least let people know when you’ll be back. And, after a while, you could repost older content to draw people to your website with existing content.

2. Write captivating excerpts

When you decide to share your blog post on social media, make sure to select or write a short and appealing excerpt in order to draw people in. You could, for instance, choose the most important sentence or the main point of your post. Or you could simply choose to share the introduction of the blog post, if you feel that is captivating enough. You want this piece of text to get people to click on the link and read the whole post. And do ensure that people can easily navigate to other pages on your website, once they are there.

Our SEO for WordPress eBook guides you through every aspect of Search Engine Optimization »

SEO for WordPress$ 25 - Buy now » Info

3. Diversify

You can share different types of posts on your social media account. As mentioned in point 1, you could share your blog posts, but you could also share short news items, videos or simply some (behind-the-scenes) pictures. These kind of posts can make our brand more fun and personal.

In order to decide which posts do well on social media, you should analyze the number of views, shares and likes. Of course, we’d advise to share types of posts that receive a lot of views and likes more often.

4. Handle comments

If you share your posts on social media, you could also receive comments. Don’t forget to monitor this. You should handle these comments swiftly.

Read more: ‘How to handle comments on your blog’ »

5. Use awesome illustrations

For some social media (Pinterest and Instagram) it is all about the illustrations. But also on Facebook visual content is really important. They make your post stand out from all of the other posts in someone’s timeline, and can boost clickthrough.

When you use Yoast SEO Premium you can check what your blog post or product page will look like, before sharing it on Facebook and Twitter. See how easy that is!

6. Be part of the community

If you’re active in a certain community or niche, you’ll soon discover other interesting people in that area that your audience follows. Follow them too and interact with them, this could help your and their audiences grow.

7. Add metadata

Smart use of (hash)tags can also help your growth immensely. For instance if you are at an event, include the hashtag for that event in your post, so everyone searching for that event will come across it. There are also hashtags for certain interests or technology. Some people might even retweet everything that is posted in a certain hashtag, which is a great way to boost your post. But don’t go overboard! Nobody likes a post that is filled with all kinds of random hashtags.

Conclusion

Social media is a key aspect of every SEO strategy. Setting up a decent social media strategy can be hard and will ask for a bit of creativity. And, it’ll definitely consume much of your time. But, it’ll be worth it! And if you think about it, social media and blogging are very similar in many aspects.

Keep reading: ‘Social media strategy: where to begin’ »

To help your blog gain more readers, you can make use of social buttons which allow your current readers to share interesting posts on their social media accounts. But how should you go about implementing them? In this post we’ll explain how we’ve done this at Yoast and will give you some pointers on how to get started.

Optimize your site for search & social media and keep it optimized with Yoast SEO Premium »

Yoast SEO for WordPress pluginBuy now » Info

What are social buttons?

For those who don’t know what social buttons are: They’re the buttons that you’ve seen around the internet that are usually placed somewhere below a blog post that allow readers to share articles on various social media platforms. This is great for gaining extra exposure and thus also getting more traffic to your website.

At Yoast, our social buttons look as follow:

Social Buttons

How did you implement these social buttons in WordPress?

Now you might be wondering about how these buttons were implemented. Your initial thought might be that this was added with some kind of plugin. However, at Yoast we decided to add it to our theme. This gives us extra control in how we style and display things. Of course we could have decided to add these buttons to a plugin, but the added benefit would be minimal for us.

We’ve decided to place the code for the social buttons in a template partial. This way we can easily embed it throughout the website without having to drastically edit template files or having to embed the buttons manually per post.

Here’s a basic example of how we implemented a social button for Facebook. Note that not all the code is actual production code and has been replaced with psuedo-code to make implementation easier to understand.

<?php
// File: <theme_folder>/html_includes/partials/social-share.php
function facebook_social_button() {
$article_url = get_article_url(); // Psuedo-code method to retrieve the article's URL.
$article_url .= '#utm_source=facebook&utm_medium=social&utm_campaign=social_buttons';

$title = html_entity_decode( get_og_title() ); // Psuedo-code method to retrieve the og_title.
$description = html_entity_decode( get_og_description() ); // Psuedo-code method to retrieve the og_description.
$og_image = get_og_image(); // Psuedo-code method to retrieve the og_image assigned to a post.

$images   = $og_image->get_images();
$url = 'http://www.facebook.com/sharer/sharer.php?s=100';
$url .= '&p[url]=' . urlencode( $article_url );
$url .= '&p[title]=' . urlencode( $title );
$url .= '&p[images][0]=' . urlencode( $images[0] );
$url .= '&p[summary]=' . urlencode( $description );
$url .= '&u=' . urlencode( $article_url );
$url .= '&t=' . urlencode( $title );
echo esc_attr( $url );
}
?>
<div id="social-share">
<div class="socialbox">
<a rel="nofollow" target="_blank" data-name="facebook" aria-label="Share on Facebook" data-action="share" href="<?php facebook_social_button(); ?>">
<i class="fa fa-facebook-square text-icon--facebook"></i>
</a>
</div>
</div>

The above code could be used in a similar fashion for other social media platforms, but it can vary greatly in terms of URL structure. We advise you look at the documentation of your desired platforms to ensure compatibility.

To include these social buttons in your blog posts, open up single.php in your theme’s folder and paste the following snippet where you want the buttons to appear:

<?php get_template_part( 'html_includes/partials/social-share' ); ?>

That’s it! If you don’t want to collect interaction data from these buttons, then this is all you need. If you want interactions to be tracked, then read on.

Tracking Interaction with Social Buttons

Having nicely styled social buttons in your website is one thing, but tracking the actual interactions with them would be even better.
At Yoast, we use JavaScript to ensure the tracking of the social media sharing is done correctly so we can easily see what social media platforms are popular among our readers.

The code for this is relatively simple and depends on the Google Analytics Tracker being properly implemented into your website. Assuming this is the case, the following code will be of great help:

jQuery( document ).ready( function( $ ) {
	$( '.socialbox a' ).click( function( e ) {
		e.preventDefault();
		
		if ( typeof __gaTracker !== "undefined" ) {
			__gaTracker( 'send', 'social', $( this ).data( 'name' ), $( this ).data( 'action' ), document.querySelector( "link[rel='canonical']" ).getAttribute( "href" ) );
		}
	});	
});

Get the most out of Yoast SEO, learn every feature and best practice in our Yoast SEO for WordPress training! »

Yoast SEO for WordPress training$ 99 - Buy now » Info

The above JavaScript snippet passes in some of the extra information we passed along to the anchor tag. This extra information can be identified by the data- prefix and is retrieved by calling $( this ).data( [...] ). This method allows us to easily extend the social-share div and add more buttons.

If you want more information on how Google tracks this information, you can read about it here.

Conclusion

As you can see, it’s not very difficult to add social buttons to your blog. Even tracking them in Google Analytics has become a breeze compared to past implementations.

All that’s left is to go and implement the buttons and allow your readers help promote your posts. Good luck!

Read more: ‘Social media optimization with Yoast SEO’ »

Once your website starts growing and you continue writing blog posts, you’ll eventually end up with archive pages. These archive pages can be based on taxonomies, categories, custom post types and even dates. WordPress has built-in support for these archive pages, however there are some small drawbacks. In this post, I’ll explain to you how you can use these archive pages in a better way and ensure they actually add value to your blog.

Default archive pages

WordPress supports automatic creation of archive pages. This ensures that you don’t have to think about making them by hand. Sadly, these pages tend to only consist of a list of posts based on a category / taxonomy / post type without any further introduction. This means that your visitors are left stranded on a page without much explanation about what they’re looking at. The chances of your visitors finding what it is they’re looking for are terribly slim in this case and usually visitors will decide to leave that page immediately.

A simple solution to this problem: Add an “introduction” of some sorts to the page. A clear header can already greatly help out your visitors, but for extra important pages we recommend adding a description as well to better highlight the content that can be found on that archive page.

Before avidly writing these introductions, lets ensure they are properly displayed on the pages.

Learn how to structure your site well with our Site structure training! »

Site structure training$ 99 - Buy now » Info

Adding the introduction

Category, tag and custom taxonomy archives

If you want to add an introduction to a category, tag or custom taxonomy archive, you can easily create a custom template file to override the default ones. For example, you can create a `category.php` file in your theme to override the default template file. If you want more information on how the templating hierarchy works in WordPress, just look at this infographic before continuing.

In your newly created `category.php` template file, add the following snippet above the WordPress loop:

if ( ! get_query_var( 'paged' ) ) {
  echo wpautop( term_description() );
}

If you want to support shortcodes, try this instead:

if ( ! get_query_var( 'paged' ) ) {
  echo wpautop( apply_filters( 'the_content', term_description() ) );
}

The above code takes the title and description that you added in the WordPress backend for the category and displays it on the category archive page. This method also applies to tag and custom taxonomy archives.

If you use the Genesis theme, you won’t have to do any of the above alterations. Luckily, Genesis already has built-in support for this type of thing, so it’s as easy as ticking two checkboxes in the theme settings.

Genesis Archive Settings

Or if that doesn’t work, you can just add this to your Genesis child theme’s functions.php:

function yoast_term_archive_intro() {
 if ( ( ! is_category() && ! is_tag() && ! is_tax() ) || get_query_var( 'paged' ) ) {
   return;
 }

 echo '<h1 class="entry-title">' . single_term_title('', false) . '</h1>';
 echo '<div class="entry-content">' . wpautop( term_description() ) . '</div>';
}

add_action( 'genesis_before_loop', 'yoast_term_archive_intro', 20 );

Of course, you are free to expand the above function to add some more CSS classes to further style the output.

Custom Post Type archives

Altering custom post type archives is a bit trickier than overriding default tags, categories and taxonomies. You can add a new file called `archive-{posttype}.php` where you replace the `{posttype}` portion with the name of your custom post type. By then adding the following code to said file, you can achieve a similar result:

if ( ! get_query_var( 'paged' ) ) {
  $post_type = get_post_type_object( get_post_type() );
  echo '<h1>' . $post_type->labels->name . '</h1>';
}

Now for the hard part. Because custom post types don’t have any type of form in the WordPress backend, it is impossible to easily add a description to these custom types nor is there a recommended way of storing the data. One method you can use when you use a child theme in Genesis, is by expanding the `functions.php` file with the following code:

function yoast_cpt_intro() {
  if ( ! is_post_type_archive() || get_query_var( 'paged' ) ) {
    return;
  }

  $post_type = get_post_type();
  
  if ( genesis_get_option( $post_type . '-title', 'child-settings' ) ) {
    echo '<h1>' . genesis_get_option( $post_type . '-title', 'child-settings' ) . '</h1>';
    echo wpautop( genesis_get_option( $post_type . '-intro', 'child-settings' ) );
  }
}

add_action( 'genesis_before_loop', 'yoast_cpt_intro', 20 );

As you may have noticed, the code example uses two custom genesis options: `$post_type . ‘-title’` and `$post_type . ‘-intro’`. These can be defined in your Genesis child theme. You can read how to do that over here.

Preventing duplicate content issues

To avoid duplicate content issues, the previous code snippets make use of a simple check to ensure we’re not on a paginated page. The `get_query_var( ‘paged’ )` function call determines whether or not we’re on a paginated page.
If it detects the query variable `paged`, we can assume that this page is one in a series of multiple pages and thus should not display the description.

Since the introduction of rel=”next” and rel=”previous”, websites that have paginated archives and whom have properly implemented the `rel=”next”` and `rel=”previous”` attributes, will be receiving more visitors on the first page in the series. Nevertheless, you should not solely rely on this, but use it in conjunction with the `get_query_var( ‘paged’ )` option.

Styling the archive introduction text

To ensure that people actually read the introduction text, it’s very important to add proper styling to the page. After all, these introductions need to be made with humans in mind first, SEO second. Don’t fall in the trap of styling it the same way as your posts as this might result in visitors not understanding that the text is actually something entirely different from your content. A good example can be seen in the following screenshot:

Conclusion

Based on the information shared in this post, you should be able to make clear archive pages that help your visitors understand the content they are looking at. Additionally, you should be able to create these archive pages for custom post types. We look forward to seeing some of your beautifully styled archive pages.

Read more: ‘Site structure: the ultimate guide’ »

When talking with customers about Google Analytics, you often hear the same thing: “I’m not really using Google Analytics because I don’t know what I’m looking at. It’s just too much”. And that’s a pity because you can learn a whole lot about your website and your audience with Google Analytics’ data. So, is there a simple way to use Google Analytics without getting lost? There might be, by using segments.

What’s a segment?

In Google Analytics a segment is a way to specify the data you’re seeing in every standard view. Google Analytics just throws it all in there, on one big pile of data. This means that when you’re looking at a standard view in Google Analytics you see: ‘all sessions of all visitors’, you see: total revenue, all pages, average time on page of all users, the landing pages of all visitors.

You might recognize this: You’re in the Acquisition section and you’re all happy, because you’ve created the perfect table. You’ve used the advanced filter option to include the Medium: “Organic” and you’re seeing the data you want to see. Then you think: “I’m curious to see which pages these visitors looked at, let’s take these filters to the next section of Google Analytics.” You hit the Behavior section and Poof! your filter is gone. Oh, the frustration!!!

If you want to know which pages people coming from organic search visit, you need to find another way. A segment helps you to narrow down the aggregated data Google Analytics shows, into data you want to see and need, to answer a specific question you have. You can use that segment throughout the sections, the segment doesn’t get lost when switching between sections. For instance, if we want to know which source customers who bought an eBook came from, we can create a segment of people who bought an eBook. By applying that segment and looking at the Acquisition – Source/Medium section, we can conclude that most of our eBook customers came from a newsletter. Goodbye frustration!

Become a technical SEO expert with our Technical SEO 1 training! »

Technical SEO 1 training$ 179 - Buy now » Info

Why do you need segments?

Without segmentation, all data you see is aggregated. This makes it really hard to draw conclusions. As Avinash Kaushik once said: “All data in aggregate is crap.” And I certainly agree with him. If you want to draw a valid conclusion, you need to specify your data.

For example, you can’t just say that most of your visitors visit your site around noon. Well okay, you can. But what does it mean? This data is so aggregated that you can’t build a strategy on it, it doesn’t provide any insight. Based on this data you might conclude that promoting a new product around noon is the way to go. But what if a large amount of your non-paying visitors visit your site around noon, but your high-potential visitors visit your site in the evening? Then you could’ve made the wrong decision based on non-specific aggregated data. So with a segment, you can zoom in on a specific part of your data. And if you do that right, you can make important business decisions that help your business move forward.

How to create a segment in Google Analytics?

First of all, creating a segment in Google Analytics isn’t dangerous. You can edit your segments, you can delete your segments, but you won’t delete the actual data you have. For me this was an important realization, because it meant that I could just ‘play’ with segments without any consequences.

The first step is thinking about what kind of segment you need. Which question do you want answered? What’s important for your business? And where can you find the data to create that segment? Do you want to segment on demographics of the user? And/or, the behavior of the user? Or, the technology the user uses to visit your website? And so on. Knowing what it’s called what you’re looking for in Google Analytics really helps when creating segments.

The second step is adding the actual segment. You can find the segment section at the top of the page in every view from Audience down to Conversions.

add a segment in Google Analytics

This means that if you’re in Dashboards, Shortcuts, Intelligence Events or Real-Time section, you can’t see the segment section.

System segments

Google Analytics offers ‘fixed’ segments which you can find in the ‘System’ section. A lot of these segments are pretty darn useful. For example, there’s an Organic Traffic segment that groups all visitors that came from an organic search result to your site. Very useful, if you want to know which landing pages these users visit. Another example: There’s a Mobile Traffic segment, that groups users that use a mobile device to visit your site. Very helpful as well, for example to find out if the ‘time on page’ is what it should be, this might say something about the mobile friendliness of your site.

Custom segments

There are more segments to think of than the system segments Google Analytics offers. For instance, you can create a segment that filters out all visitors that spend less than half a minute on your site. Or you can create a segment that focuses on the organic traffic from all visitors from the Netherlands. Or, as mentioned before, create a segment based on the products visitors bought or a certain amount of revenue a visitor yielded.

I found this video on YouTube that explains creating a custom segment pretty well:

For me, a couple of segments are really useful. I have segments for every country that’s important for our business, for every product and for every product page. And I have a segment for every medium like Organic, Newsletter and in our case: plugin traffic.

Compare segments

A nifty feature in Google Analytics is the ability to add more than one segment for the same view of data. This means you can compare different segments. For instance, if you created a segment of visitors that stayed longer than 5 minutes on your website and created a segment of visitors that stayed less than 1 minute on your website, you can compare the two and find out more about the behavior of these two groups and in which aspects these two groups differ.

Conclusion

If you want to know what you’re looking at, when clicking your way through Google Analytics, segmentation is the way to go. If you have questions like, “how do the visitors from California behave on my site?” Or, “what are my newsletter visitors doing on my site?” “How’s my campaign going?” Creating a segment is the easiest way to go. It’s a way to dissect your data and actually know what you’re looking at, when looking at all the different sections in Google Analytics. Say farewell to your Google Analytics frustration!

Read more: ‘Facebook Page Insights explained’ »

There are several reasons for cloaking or redirecting affiliate links. For instance, it’s easier to work with affiliate links when you redirect them, plus you can make them look prettier. But do you know how to cloak affiliate links? We explained how the process works in one of our previous posts. This Ask Yoast is about the method of cloaking affiliate links we gave you in that post. Is it still a good idea to redirect affiliate links via the script we described?

Elias Nilson emailed us, saying that he read our article about cloaking affiliate links and he’s wondering if the solution is still up-to-date.

“Is it still a good idea to redirect affiliate links via the script you describe in your post?”

Check out the video or read the answer below!

Get the most out of Yoast SEO, learn every feature and best practice in our Yoast SEO for WordPress training! »

Yoast SEO for WordPress training€ 99 - Buy now » Info

Redirect affiliate links

Read this transcript to figure out if it is still a valid option to redirect affiliate links via the described script. Want to see the script directly? Read this post: ‘How to cloak affiliate links’:

Honestly, yes. Recently we updated the post about cloaking affiliate links, so the post and therefore the script is still up to date. Link cloaking, which sounds negative, because we use the word cloaking, is basically hiding from Google that you’re an affiliate. And if you’re an affiliate, that’s still the thing that you want to do, because usually Google ranks original content that is not by affiliates better than it does affiliates.

So, yes, I’d still recommend that method, the link will be below this post, so you can see the original post that we are referencing to. It’s a very simple method to cloak your affiliate links and I think it works in probably the best way that I know.

So, keep going. Good luck.

Ask Yoast

In the series Ask Yoast we answer SEO questions from followers. Need help with SEO? Let us help you out! Send your question to ask@yoast.com.

Read more: ‘How to cloak your affiliate links’ »

At Yoast, we sometimes receive the question how to remove www from your website’s URL – or add it. In this post, I’ll show you how you can enforce either a www or non-www URL by tweaking your .htaccess file (or nginx.conf if you’re running on an Nginx server).

Get the most out of Yoast SEO, learn every feature and best practice in our Yoast SEO for WordPress training! »

Yoast SEO for WordPress training$ 99 - Buy now » Info

Does using one or the other impact SEO?

You might be wondering if using one or the other will have an impact on your SEO. The answer is: no. It’s really just a matter of preference/esthetics. Just make sure you properly add the www and non-www domains in Google Search Console, as described here, to ensure Google can properly index your website.

Removing www from your domain name

If you prefer to market your website without the www prefix, you can add the following lines to your .htaccess file (Apache only):

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

Restart Apache and check that you get redirected to the non-www version when using the www prefixed URL.

Note that Apache’s mod_rewrite module needs to be enabled. Otherwise, the above snippet won’t work.

Now, in Nginx this snippet is a bit different, but yields the exact same result when placed in the proper configuration file (which depends on your setup):

server {
 server_name www.example.com;
 return 301 http://example.com$request_uri;
}

Now just restart Nginx and you should be good to go!

Adding the www instead of removing it

To do the opposite of the previous section, add the following code to your .htaccess file:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^example.com$ 
RewriteRule (.*) http://www.example.com$1 [R=301]

And in Nginx, all it takes is this:

server {
 server_name example.com;
 return 301 http://www.example.com$request_uri;
}

That’s all there is to it!

Read more: ‘Ask Yoast: www and duplicate content’ »

If you start a new site, either a blog or an online shop, you won’t rank immediately. So, what’s the first step you need to take to boost your rankings? In our view, you should always start with keyword research. Take some time to think about the words you want to be found for: which words are your audience searching for? But how do you find that out? What tools are useful? And, when you’ve found those keywords, how do you determine which ones you should focus on first? The most competitive (head), or the less competitive (long tail) keywords? In this post we’ll illustrate with a case study how to start your keyword research.

Focus on head or tail? Google it!

My cousin Sanne recently started her own online shop: Made by Mae. She’s a graphic designer and designs really cute posters, postcards and milestone cards. She asked me about SEO: where should she start? “Did you do your keyword research?” I asked. She did. She wanted to rank for the Dutch translation of [personalized poster]. And she already figured that aiming for those high-end search terms like [postcard] en [poster] would be pretty useless.

schermafbeelding-2017-01-10-om-11-39-55

Choose the right locale

Make sure to Google your specific keyword in the language that you’re using on your website. And, in the case of my cousin, make sure to use Google.nl. She’s mainly interested in selling stuff in the Netherlands, so she should only worry about ranking in the Netherlands.

But how do you know for sure? You should check the competition! Google the keywords that are the most competitive and analyze the results. Are these major companies? Companies with large marketing budgets? Then you’ll probably have a hard time ranking for these head terms. Ask yourself what the probability is that you’d be able to rank for such a term. Then, try a term that is slightly less competitive, and see what comes up. Did the probability change much?

If you do this, starting from very competitive head terms to slightly longer and less used search terms, you’ll get a pretty good idea of where your website should be able to fit in and rank. For Made by Mae, focusing on (the Dutch translation of) [postcards] and [posters] would be a bit too difficult to go after just now. [Trendy postcards] or [trendy posters] results in less competition. I would choose even less competitive search terms like [personalized trendy postcards].

Make a long list!

You should never focus on just one keyword. You should make a long, a very long list. My cousin should make a list of at least a hundred keywords. These could be variations of different keywords. As the menu of Made by Mae states she sells posters, personalized posters, postcards, milestone cards and printables. So my cousin should try to come up with keywords around these terms. For example: [cute milestone cards], [personalized milestone cards], [trendy milestone cards], [black-and-white milestone cards] and so on. Make sure to rate the competitiveness of each of your keywords.

Learn how to set up a keyword strategy for your site in our Keyword research training »

Keyword research training€ 99 - Buy now » Info

Start writing content

Blogging is a great way of creating content. My cousin could write really awesome blog post related to her products. She recently gave birth to a beautiful baby girl and she should have lots of inspiration. However, a keyword is not a subject of a blog post just yet. You’ll need a specific angle or topic for the keyword you would like to rank for.

Read more: ‘5 tips to find inspiration for your blog’ »

Use Google trends!

If you have to choose between certain keywords you’d like to rank for, but you don’t know which one to choose, you should use Google trends. Google trends will allow you to compare the search volume of a few terms. If you want to know whether it makes sense to write about trendy postcards or about personalized postcards, Google Trends will give you your answer:

schermafbeelding-2017-01-10-om-20-16-38

Think about chances to convert

While doing your keyword research, you should already think about the chance to convert for people searching for a specific keyword. For instance: if people are specifically searching for [black-and-white milestone cards], they will be more prone to buying a set of cards than if people are searching for [milestone cards]. People searching for [black-and-white milestone cards] already know what they want, they know what they’re searching for. Once they’ll find the milestone cards on Made by Mae, they will be more eager to buy them.

People searching for long tail, specific keywords generally have a higher chance to buy something when they end up on your website. So, perhaps, you’ll generate less traffic with a post optimized for [black-and-white milestone cards], than with a post optimized for [milestone cards], but you’ll end up with more sales nevertheless.

Conclusion

Keyword research is a very important first step in SEO. And after that, you’ll have to start writing. A lot. Writing will not instantly result in higher rankings. It’ll take time. It’s a longterm SEO strategy. But it will pay off eventually!

Keep reading: ‘Keyword research: the ultimate guide’ »

At Yoast, whenever we do a website review, we frequently recommend people change their permalink structure. In this post, we’ll explain why you should consider changing your permalink structure and how to go about it.

Why change your WordPress permalink structure?

A common thing we see in permalink structures are the usage of dates. For websites that post content that is related to current events, such as news sites, this makes perfect sense. However, for most blogs, the content is usually “timeless” as it tends to cover subjects that doesn’t relate to a specific date in time.

Using dates in your permalink structure also tends to have another side-effect, namely a lower CTR for older posts that may very well still be relevant. Whenever someone sees a result in Google with a date pointing back two years ago, they’ll be less likely to click that result. Seeing as Google uses this CTR for page rankings, it might be a very good idea to change your permalink structure to something more appealing to your visitors! If you want more information, you should read our post on WordPress SEO URL / Permalink considerations.

Get the most out of Yoast SEO, learn every feature and best practice in our Yoast SEO for WordPress training! »

Yoast SEO for WordPress training$ 99 - Buy now » Info

Changing WordPress permalink structure

There are two steps in changing your WordPress permalink structure. The first step is easy: go to Settings -> Permalinks and select Post name:

Changing your permalink settings

But what about all those old posts that still have dates in their permalink? With this handy tool, you can easily have a redirect generated that can be placed in your .htaccess file. This will point posts using the old permalink structure, to the new one. 

Please note that the tool currently only supports Apache-based servers and not Nginx.

After copying the redirect over to your .htaccess file, you should go out and test if everything is working properly. If the redirect doesn’t seem to be working, it could mean that you’re not allowed to use RedirectMatch on your Apache server.

If you don’t have proper rights to edit your .htaccess file or can’t use RedirectMatch, you can also consider using our Yoast SEO Premium plugin. The built-in Redirect Manager will automatically create a redirect for you whenever you alter the permalink of a post to reflect the newly chosen structure.

Read more: ‘WordPress SEO: the ultimate tutorial’ »

Having a website, online shop or blog that’s fast is a must nowadays. A fast website doesn’t only give your visitors a much better experience, but it also helps your website to rank. Sending fewer HTTP requests to the server can improve the loading times of your website. But why is that?

What are HTTP requests?

HTTP requests are requests that get sent to the server whenever someone visits your website. These requests can contain a variety of information for the server to process and act upon. The most important part of such a request is the URL. Based on this information, the server will try to return a valid response, such as a file. The first stable implementation of HTTP, HTTP/1.0, does these requests in series. This means that a group of requests needs to be finished before the next group is sent. Obviously, this means that pages with a lot of external files will suffer from longer loading times, making your website slow.

Speeding up initial loading times

As described in the previous section, loading a lot of files one after another will result in longer loading times. Now you might be wondering “How do I speed this process up?”. Luckily, there are a few techniques and advancements in browser technology that can help you with this.

Order a website review and get a plugin of your choice for free. We'll even configure it for you »

Get a Yoast website review€ 699 - Buy now » Info

Browser pipelining

Since the introduction of HTTP/1.1, it has been possible to use a feature called “browser pipelining”. This feature allows the browser to fetch multiple files in rapid succession, without waiting for a previous request to finish. This means that the browser doesn’t have to wait as long to send off the next request.

In theory, this would be a very handy feature to have enabled by default. Sadly, in practice, this system still has some flaws. Due to its asynchronous nature, it’s possible that files load in the wrong order.

Let’s take a custom jQuery plugin as an example of how browser pipelining could do more harm than good. As your custom plugin depends on jQuery, the jQuery library needs to be fully loaded before your plugin can properly run. You might already see where this could go wrong; because browser pipelining doesn’t wait for previous requests, your plugin could load before jQuery. The result? JavaScript errors.

This problem with load order can also easily occur with something like images. In the case of images, it’s possible that the order in which the images get displayed differs from the actual order in your HTML.

HOL blocking

Another phenomenon that sometimes occurs when using browser pipelining is Head-of-line blocking (HOL blocking). What this means is that a particular packet (a part of a file) is keeping another packet of the same file from successfully completing. Other packets can only continue on their way once the delivery of the first package to the browser ends.

Due to the issues mentioned, most browsers disable HTTP pipelining by default. In the latest version of HTTP, aptly named HTTP/2, the issues with pipelining are addressed by using a technique called multiplexing which sends multiple HTTP requests over a single TCP connection. If you want to use this technique, make sure your server and your audience’s browsers, properly support HTTP/2.

Move JavaScript files out of the head section

There’s another way to make your website to load faster without much extra hassle. But first a brief history lesson!

Placing all the required CSS and JavaScript in your <head> section used to be considered common practice. However, the problem with this technique is that the rest of your HTML won’t display because these files block its rendering. This results in your visitors looking at a blank page for a couple of seconds.

As early as 2007, a new best practice surfaced. This best practice recommends moving all the JavaScript from your <head> section to the bottom of your page, just before the </body> tag. Why? Because JavaScript blocks any further rendering of a page until it has loaded all its files. By moving the JavaScript, the page’s HTML renders first instead of last. Sometimes it’s possible that you want the rendering of the page to wait until a particular JavaScript file loads. This would be the only exception when it comes to moving files out of the <head> section of your HTML.

Moving CSS to the bottom of the page is not recommended, as it stops the browser from correctly displaying and formatting your content. This impacts the overall user experience. Nobody wants to visit a website where text jumps around the screen because a stylesheet doesn’t load until the very end. Although moving your JavaScript to the bottom of your page doesn’t reduce the number of HTTP requests, it does help improve the overall experience.

Reduce the number of files

Another option to speed up your website is by limiting the number of files that load. This is because for every file you try to load, your browser sends a separate HTTP request to the server. Fewer files means fewer requests and therefore a faster website.

Most commonly, JavaScript, CSS, and images are the main culprits when it comes to slow loading pages. To combat this, you can use a few techniques, namely:

Minifying and concatenating your JavaScript and CSS files.

By minifying and concatenating assets such as CSS and JavaScript, you not only reduce the overall file size, but you also minimize the amount of files that need to load. A good rule-of-thumb is to group files based on their respective functions; if you have multiple files that do something with image manipulation, it might be a good idea to concatenate those.

Additionally, by limiting the amount of CSS files that load initially, you reduce the overall loading time. In that case, minification and concatenation can help as well. After the initial loading of CSS files, your browser caches it so subsequent requests shouldn’t take up as much time. You can imagine that having a single file with all the relevant CSS, plus the caching, can significantly improve the overall experience.

If you have CSS that is very specific for a particular page, you’re better off loading that file separately. As a result, you won’t unnecessarily ship specific CSS rules that aren’t used elsewhere in your HTML.

There are plenty of online tools to help you with minification and concatenation during development. You can also use a plugin, such as WP Rocket, to help you out with this.

Optimizing images

Some themes are heavily dependent on pictures. Because images are also separate files themselves, they too fall victim to the limitations of HTTP. To get around this, it is possible to make use of a technique called CSS spriting. This technique allows you to take multiple images (usually of a similar size) and reduce them into a single image. Then with some smart CSS techniques, you manipulate the sprite and only display a specific part of it. There are a couple of online tools that can help with this, such as SpriteMe. It’s unnecessary to create sprites for _all_ your images, but it’s worth putting in the extra effort for things like backgrounds and social media icons.

Lazy loading

Another way to ensure images won’t make your pages slow, is using a “lazy loading” plugin. Lazy loading is a technique where some JavaScript looks at the current viewport of the visitor and only loads images that are (almost) within view. A good plugin for this is the Lazy Load plugin which delays loading of images until the user starts scrolling down the page.

Bonus tip: use a CDN

Finally, here’s an extra tip. Content Delivery Networks, or CDNs, are a network of optimized servers across the globe that guarantee fast delivery of static content such as images, CSS and JavaScript. The main advantage of using a CDN is that you’re retrieving content from a separate server. This overcomes one of the HTTP restrictions which limits sending a large amount of requests to a single server in one go. By overcoming this restriction, you can achieve shorter loading times! Another advantage of these CDN’s is that the data comes from a server closest to your visitor’s physical location. Shorter distances to the server means faster data retrieval. It’s possible to use more than one CDN, which means your browser can deal with even more HTTP requests at the same time.

Here at Yoast, we use MaxCDN (affiliate link), but with the rising popularity of CDN’s, there are plenty others to choose from. Once you’ve found a CDN provider of your liking, using a caching plugin like WP Rocket can help you to configure your CDN for your website.

Conclusion: Reduce those HTTP requests

As you can see, plenty techniques are available to decrease the loading time of your website. By far, the biggest improvement you can make is reducing the amount HTTP requests you send to the server. Additionally, making the files smaller through minification can also help speed things up.

So, go forth and optimize your CSS and JavaScript! Lower those HTTP requests! Your visitors and servers will thank you for it.

Read more: ‘Site speed: tools and suggestions’ »