Google Search Console Microdata

When running a site through Search Console, Google started crying and complaining that I didn’t have author or date micro data.  Boo frickin’ hoo! 😉

Anywho I search for a while, tried a few things and found this code that fixes it:

Add this to your functions.php in your CHILD theme (you better be using a child theme, mister!)

//code to make google search console happy about microdata
function add_atom_data($content) {
$t = get_the_modified_time('F jS, Y');
$author = get_the_author();
$title = get_the_title();
if (is_home() || is_singular() || is_archive() ) {
$content .= '<div class="hatom-extra" style="display:none;visibility:hidden;"><span class="entry-title">'.$title.'</span> was last modified: <span class="updated"> '.$t.'</span> by <span class="author vcard"><span class="fn">'.$author.'</span></span></div>';
}
return $content;
}
add_filter('the_content', 'add_atom_data');

It’s here: https://thomas.vanhoutte.be/miniblog/missing-updated-wordpress/

 

A Good .htaccess File

I’m a bit new to this side of things but for now this is the .htaccess file I’m using when I want everything to point back to http://www.site.com/

EDIT: I updated on 5/20/13 and 8/15/13 to add several options that can be removed.

RewriteEngine on

# Proper 404
ErrorDocument 404 /404.php
# 301 Redirects of old page names
RedirectPermanent /old-page.php http://www.site.com/new-page.php

# Force index.php to go to root
RewriteCond %{THE_REQUEST} ^.*/index.php 
RewriteRule ^(.*)index.php$ http://www.site.com/$1 [R=301,L] 

# Force www
RewriteCond %{HTTP_HOST} !^www.site.com$
RewriteRule ^(.*)$ http://www.site.com/$1 [R=301]

# Allow with or without PHP extension
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]

# Force trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ http://www.site.com/$1/ [R=301,L]

Also I should have figured this out years ago but I shouldn’t just reference index.php and the like in an href, do it up right with the full URL http://www.site.com/

Converting a site to WP but doing the right SEO stuff

Mainly what you have to do is:

  1. Convert the site to WP
  2. Once all is good with WP edit .htaccess
  3. Above all the wordpress stuff you have to add this type of thing: Redirect 301 /myoldurl.html http://mydomain.com/newpagename
  4. You have to add that for each old file that you want to redirect to the new file
  5. There is info all over the net, including here: http://stackoverflow.com/questions/3696002/converting-a-static-site-to-a-wordpress-site-how-to-transfer-convert-seo-ranki

301 Redirect and Canonicalization

This is a bit web design related and a bit SEO related but basically watch this video:

http://www.google.com/search?client=safari&rls=en&q=canonical+matt+cutts&ie=UTF-8&oe=UTF-8#q=canonical+matt+cutts&hl=en&client=safari&rls=en&prmd=imvnso&source=lnms&tbm=vid&ei=VpYhT57qHcqBgwfXy4D1CA&sa=X&oi=mode_link&ct=mode&cd=4&ved=0CBEQ_AUoAw&bav=on.2,or.r_gc.r_pw.r_cp.,cf.osb&fp=cb0215ac689da41e&biw=1089&bih=1024

Then check these sites on how to fix it.

http://knowledge.freshpromo.ca/seo-tools/301-redirect.php

http://www.barrywise.com/2008/10/seo-canonical-urls-and-301-redirects-in-windows-iis-6-iis-7/

http://www.searchenginepeople.com/blog/hwoto-canonical-headers.html