Share
Embed
Jono Alderson'-Turbocharging your Wordpress Website
Distilled
December 04, 2014
Transcript
162 slides
-
@jonoalderson Turbo-charging your WordPress website I’m going to make you
care about technical SEO. -
@jonoalderson Turbo-charging your WordPress website ! Jono Alderson Head of
Insight @ Linkdex! @jonoalderson ! Technical SEO + analytics geek Closet web developer & Wordpress fanatic -
@jonoalderson Turbo-charging your WordPress website ! So, like any good
SEO, I needed a website. -
@jonoalderson Turbo-charging your WordPress website When we started talking about
content marketing, we stopped talking about technical optimisation. ! “on page” is not the same as “technical” -
@jonoalderson Turbo-charging your WordPress website We’ve all seen the impact
of technical bugs/faults/etc. ! Broken pages, missing redirects, indexation faults, etc... -
@jonoalderson Turbo-charging your WordPress website Ditch the crappy metaphor! Yes,
it works as a loose analogy, but it gives people permission to think about it in an abstract sense. -
@jonoalderson Turbo-charging your WordPress website Visualising Performance Speed • Google
PageSpeed Insights, ySlow • Google Analytics • Pingdom, WebPageTest* -
@jonoalderson Turbo-charging your WordPress website There is no ‘site speed’
number which Google uses. An aside… Developers HATE this. -
@jonoalderson Turbo-charging your WordPress website Visualising Performance User Experience •
How’s it “feel”? Consider the psychology of the loading experience • User experience index, general quality, give-a-damn • Track it, benchmark it. Surveying and feedback tools -
@jonoalderson Turbo-charging your WordPress website Visualising Performance Technical optimisation &
security • Bandwidth/overhead optimisation • Adoption of technologies (open graph, responsive images, caching, etc) • Minimising risks of hacking, DDOS -
@jonoalderson Turbo-charging your WordPress website Visualising the stack 6. HTML
& DOM parsing (and CSS + JS) -
@jonoalderson Turbo-charging your WordPress website So let’s start with something
easy. My ‘must have’ WordPress plugins -
@jonoalderson Turbo-charging your WordPress website Don’t go anywhere without installing:
! W3 Total Cache* Redirection BWP Sitemaps Broken Link Checker iThemes Security* Akismet* Query Monitor -
@jonoalderson Turbo-charging your WordPress website You may also like... !
BWP Minify Yet Another Related Posts Plugin* YARPP Experiments Relevanssi* WP-PageNavi Kraken.io* Google Tag Manager for Wordpress User Role Editor Custom Post Type Permalinks -
@jonoalderson Turbo-charging your WordPress website Third Party Services Cloudflare (or
MaxCDN) NewRelic An SSL certificate (ssl2buy.com) ! ...some kind of backup processes... ...and some proper hosting... -
@jonoalderson Turbo-charging your WordPress website “My wordpress seo tends to
be limited to ‘install the yoast plugin’ and do the usual site stuff...” Jim Seward, @iamoldskool -
@jonoalderson Turbo-charging your WordPress website Is this really an issue?
What are the experts doing? -
@jonoalderson Turbo-charging your WordPress website If everybody’s only running at
80%... ...Want the rest? -
@jonoalderson Turbo-charging your WordPress website Buy yourself some hosting.
You can only learn this stuff by doing -
@jonoalderson Turbo-charging your WordPress website DIY HOSTING Shared, Dedicated, or
VPS *(vs Clusters & hardcore setups, AWS elastic cloud computing) -
@jonoalderson Turbo-charging your WordPress website wp-config.php Security settings Auto update
settings Limit revision & trash storage Cookie stuff Set memory allowance Force SSL Set language ! http://codex.wordpress.org/Editing_wp-config.php -
@jonoalderson Turbo-charging your WordPress website Expert tip... Reference the
Template Hierarchy URL -> <- Page -
@jonoalderson Turbo-charging your WordPress website Expert Tip... You can use
pre_get_posts to intercept and change how requests are processed -
@jonoalderson Turbo-charging your WordPress website URL Structures (Permalinks) Default
/?p=%post-id%! http://www.example.com/?p=123 -
@jonoalderson Turbo-charging your WordPress website URL Structures (Permalinks) ‘Pretty’
/%category%/%postname%/! http://www.example.com/cat/page/ -
@jonoalderson Turbo-charging your WordPress website URL Structures (Permalinks) ‘Flat’
/%post-id%-%postname%/! http://www.example.com/123-page/ -
@jonoalderson Turbo-charging your WordPress website ! Custom Error Files !
<?php // Set headers before outputting the page HTML header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); header('Retry-After: 3600'); // 1 hour = 3600 seconds ?> <html> ... wp-content/maintenance.php wp-content/db-error.php -
@jonoalderson Turbo-charging your WordPress website Expert Tip... Clean up WP
and plugin overheads // Clean up wp_head() function cleanhead() { remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'feed_links_extra', 3 ); remove_action('wp_head', 'feed_links', 2 ); remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 ); remove_action('wp_head', 'rel_canonical'); remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0 ); } add_action('init', 'cleanhead'); -
@jonoalderson Turbo-charging your WordPress website Expert Tip... Clean up WP
and plugin overheads // Ged rid of superfluous CSS function deregister_styles() { if (!is_admin()) { wp_deregister_style('avatars'); wp_deregister_style('imgareaselect') wp_deregister_style('avatar-manager.css'); wp_deregister_style('yarppRelatedCss'); } } add_action( 'wp_print_styles', 'deregister_styles'); -
@jonoalderson Turbo-charging your WordPress website Expert Tip... Kill unnecessary templates
// Kill misc pages add_action('template_redirect', 'jono_nerf_pages'); function jono_nerf_pages() { global $wp_query, $post; if (is_day() || is_month() || is_year()) { header("HTTP/1.0 404 Not Found"); $wp_query->set_404(); } if (is_attachment()) { header("HTTP/1.1 301 Moved Permanently"); header("Location: ".get_permalink($post->post_parent)); exit; } if (is_feed()) { header("HTTP/1.0 404 Not Found"); $wp_query->set_404(); wp_query->is_feed = false; } if ((is_archive()) && (!have_posts())) { header("HTTP/1.0 404 Not Found"); $wp_query->set_404(); } } -
@jonoalderson Turbo-charging your WordPress website Your Theme Performance PHP &
database! Theme files and functions! Plugins & widgets -
@jonoalderson Turbo-charging your WordPress website I’m not going to tell
you how to configure this. Your site is unique. -
@jonoalderson Turbo-charging your WordPress website Expert Tip... You can move
redirects from out of WordPress and into .htaccess from within the plugin admin -
@jonoalderson Turbo-charging your WordPress website apple-touch-icon.png (and variants) favicon.ico (and
variants) browserconfig.xml Invalid or un-used feeds invalid page/date ranges broken internal links (and missing http links) alternate sitemap and meta data urls pages & images with weird, breaking parameters security probes legacy urls Some things to watch out for... -
@jonoalderson Turbo-charging your WordPress website The physical location of your
server & media matters. Use a CDN -
@jonoalderson Turbo-charging your WordPress website Cloudflare + Subdomains + W3
Total Cache = MAGIC Configure in W3TC as a “Generic Mirror” -
@jonoalderson Turbo-charging your WordPress website Expert Tip... Redirect requests which
resolve to your CDN subdomains (or other hostnames) // Redirect requests from non-primary domains function domain_redirect() { $hostname = $_SERVER['HTTP_HOST']; $mainDomains = array('www.daysoftheyear.com','app.daysoftheyear.com'); if (!in_array($hostname,$mainDomains)) { $uri = $_SERVER['REQUEST_URI']; wp_redirect( 'https://www.daysoftheyear.com'.$uri, 301 ); exit; } } add_action('init', 'domain_redirect'); -
@jonoalderson Turbo-charging your WordPress website Expert Tip... Use established CDNs
to server common/large resources (like jQuery) // Use Google CDN for jQuery function modify_jquery() { if (!is_admin()) { wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', false, '1.11.1'); wp_enqueue_script('jquery'); } } add_action('init', 'modify_jquery'); -
@jonoalderson Turbo-charging your WordPress website HTTPS / SSL Change to
protocol-relative URLs (//example.com/file/) References in CSS/JS & third party stuff ! Purchase & install key* (Cloudflare is MAGIC) Buy the right type (single, multi, wildcard) ! Tweak CDN config ! W3 Total Cache config -
@jonoalderson Turbo-charging your WordPress website Expert Tip... Database find &
replace update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, œš‘“›⁸find this string’”⁹, œš‘“›⁸replace found string with this string’”⁹); ...or cheat... “Search and Replace” plugin -
@jonoalderson Turbo-charging your WordPress website HTTPS / SSL Force SSL
in wp-config.php (esp. if using Cloudflare) // Force SSL define('FORCE_SSL_ADMIN', true); if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on'; -
@jonoalderson Turbo-charging your WordPress website HTTPS / SSL Force SSL
in .htaccess! ! http://www.webhostinghub.com/help/learn/website/ssl/force-website-to-use-ssl -
@jonoalderson Turbo-charging your WordPress website Media Optimisation ! Pay attention
to every detail.! Kraken, but get it right first.! Photoshop isn’t good enough; use dedicated kit -
@jonoalderson Turbo-charging your WordPress website File size is (sometimes) less
important than #requests -
@jonoalderson Turbo-charging your WordPress website Expert Tip... You can base64
encode images in your CSS -
@jonoalderson Turbo-charging your WordPress website Expert Tip... Change default media
links // Change image default link function misc_change_image_default_link() { $image_set = get_option( 'image_default_link_type' ); if ($image_set !== 'none') { update_option('image_default_link_type', 'none'); } } add_action('admin_init', 'misc_change_image_default_link', 10); -
@jonoalderson Turbo-charging your WordPress website Expert Tip... Lowercase filenames //
Lowercase filenames add_filter('sanitize_file_name', 'mfl_make_filename_lowercase', 10); function mfl_make_filename_lowercase($filename) { $info = pathinfo($filename); $ext = empty($info['extension']) ? '' : '.' . $info['extension']; $name = basename($filename, $ext); return strtolower($name) . $ext; } -
@jonoalderson Turbo-charging your WordPress website Expert Tip... Responsive Images (without
the overhead…) <picture> <!--[if IE 9]><video style="display: none;"><![endif]--> <source srcset="small-image.jpg" media="(max-width: 480px)"> <source srcset="medium-image.jpg" media="(max-width: 720px)"> <source srcset="large-image.jpg" media="(max-width: 1024px)"> <source srcset="xlarge-image.jpg" media="(max-width: 1280px)"> <!--[if IE 9]></video><![endif]--> <img srcset="xlarge-image.jpg" alt="" /> </picture> -
@jonoalderson Turbo-charging your WordPress website Expert Tip... Responsive Images (without
the overhead…) // Thumbnail sizes add_image_size( 'cols-1-small', 480, 314, array( 'left', 'top' ) ); add_image_size( 'cols-1-med', 720, 470, array( 'left', 'top' ) ); add_image_size( 'cols-1-large', 1024, 669, array( 'left', 'top' ) ); add_image_size( 'cols-1-xlarge', 1024, 669, array( 'left', 'top' ) ); ! add_image_size( 'cols-2-small', 240, 157, array( 'left', 'top' ) ); add_image_size( 'cols-2-med', 360, 236, array( 'left', 'top' ) ); add_image_size( 'cols-2-large', 512, 335, array( 'left', 'top' ) ); add_image_size( 'cols-2-xlarge', 512, 335, array( 'left', 'top' ) ); -
@jonoalderson Turbo-charging your WordPress website Stuff I haven’t talked about...
Parent/child theme relationships PHP(!) Transient caching Device-type optimisation Awkward SSL stuff (chain certificates) CSS/JS optimisation WP Cron, Ajax & the Heartbeat API Browser reflow and repaint ! (That may own websites are a bit slow, and far from perfect!) ! Take it one step at a time. -
@jonoalderson Turbo-charging your WordPress website Stop mitigating against technical impact...
...Start capitalising on technical opportunity. -
@jonoalderson Turbo-charging your WordPress website Learn (some of) this stuff!
And not just because you want to be “full stack”. -
@jonoalderson Turbo-charging your WordPress website And if you’re not at
least thinking about this stuff…? Maybe all you’re doing is “marketing”. -
@jonoalderson Turbo-charging your WordPress website Google cares about this stuff...
Because users do. Even if they don’t know they do. -
@jonoalderson Turbo-charging your WordPress website Aim for 100% (but get
there one step at a time) -
@jonoalderson Turbo-charging your WordPress website ! Jono Alderson Head of
Insight @ Linkdex! @jonoalderson ! (and also www.daysoftheyear.com)