You are on page 1of 6

The Web Developer’s SEO Cheat Sheet Get technical insights

with Moz Pro: mz.cm/free

Important HTML Elements


These affect how you show up in search results Best Practices HTTP Status Codes Webmaster Tools

Title Tag • Best between 50–60 characters 200 OK/Success Google Search Console
<head> • Important keywords near the beginning search.google.com/search-console/about
<title>Page Title</title> 301 Permanent redirect
</head> • Well-written descriptions influence
click-through rates (CTR) Bing Webmaster Tools
302 Temporary redirect bing.com/toolbox/webmaster
Meta Description Tag • Best around 160 characters 404 Not found
<head> • Each description should be unique Yandex
<meta name="description" 410 Gone (permanently removed) webmaster.yandex.com
content="This is an example."> • Well-written descriptions influence
</head> click-through rates (CTR)
500 Server error

503 Unavailable (retry later)

Image • Providing image height and width improves


page speed Canonicalization Best Practices
<img src="img/keyword.jpg" alt="descrip-
tion of image" width="100" height="100">

Common Duplicate Homepage URLs • Preferred URL = https://example.com/


• Place the following in <head> section to
https://www.example.com
Hyperlinks Best Practices
indicate preferred URL:
https://example.com <link href="https://example.com/" rel=
"canonical" />
Text Link • Use “nofollow” for paid links and https://www.example.com/index.html
distrusted content More information at mz.cm/canonical
<a href="https://www.example.com/webpage.
html">Anchor Text</a> https://example.com/index.html
• Use “sponsored” for sponsored or
compensated links
https://example.com/index.html?sessid=123
NoFollowed Link • Use “ugc” for links within user-generated
<a href="https://www.example.com/web- content
page.html" rel="nofollow">
Anchor Text</a>
• For image links, the alt attribute serves as the
anchor text

Image Link
<a href="https://www.example.com/web-
page.html"><img src="/img/keyword.jpg"
alt="description of image" height="50"
width="100"></a> “URLs” next page

| The Web Developer’s SEO Cheat Sheet | v5.0 | moz.com | Copyright 2020 © Moz, Inc. 1
URLs Best Practices

Common URL Elements • Choose shorter, human-readable URLs with descriptive keywords
h t t p s : // s t o r e . e x a m p l e . c o m / c a t e g o r y / k e y w o r d ? i d = 1 2 3 # t o p • Exclude dynamic parameters when possible (see “Canonicalization” and “Pagination”)
• When possible, place content on the same subdomain to preserve authority
1 2 3 4 5 6 7 8 Recommended: https://example.com/blog
Less ideal: https://blog.example.com
1. Protocol 2. Subdomain 3. Root domain 4. Top-level domain
5. Subfolder/path 6. Page 7. Parameter 8. Named anchor

Robots Exclusion Standard Best Practices Important User Agents

Robots.txt • Only Meta Robots and X-Robots-Tag remove For Robots.txt, Robots Meta Tags, and X-Robots-Tag:
Location: https://example.com/robots.txt URLs from search results
• Googlebot (can be used as default for most • Baiduspider
• Don’t block CSS or JavaScript files with Google crawlers)
User-agent: googlebot
robots.txt • FacebookExternalHit
Disallow: /example.html
• Googlebot-News
Sitemap: https://example.com/sitemap.xml • Applebot
• Googlebot-Image
More information at mz.cm/robotstxt • Slurp
• AdsBot-Google
• Twitterbot
• Mediapartners-Google (Mobile Adsense)
• Rogerbot
X-Robots-Tag Important Parameters or Mediapartners
Location: Sent in the HTTP headers • Dotbot
• Googlebot-Video
• Noindex (do not index)
X-Robots-Tag: noindex
• Wildcard for all robots: *
• Bingbot
• Nofollow (do not follow links)
More information at mz.cm/x-robots • Yandexbot
• Noarchive (do not show cache)
...or combine (noindex, nofollow)
Meta Robots
Location: In the HTML <head> If the robots <META> tag is not defined, the
default is "INDEX, FOLLOW"
<meta name="robots" content="[PARAMETER]" />
Don’t block noindex URLs in robots.txt.
More information at mz.cm/x-robots They need to be crawled to be respected.

“Sitemap Syntax” next page

| The Web Developer’s SEO Cheat Sheet | v5.0 | moz.com | Copyright 2020 © Moz, Inc. 2
Sitemap Syntax Important Social Metadata

XML Sitemap Example: Default Location: Sample Meta Tag Template: "Article"
RSS and text sitemaps are also options https://example.com/sitemap.xml Place this data between the <head> tags of your website.

<?xml version="1.0" encoding="UTF-8"?> sitemap: parent tag for each sitemap <!-- Required Open Graph data -->
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <meta property="og:title" content="Developer's Cheat
<url> loc: location of the sitemap Sheet to SEO" />
<loc>http://www.example.com/foo.html</loc> <meta property="og:type" content="article" />
<lastmod>2019-06-04</lastmod> lastmod: the last modified date <meta property="og:image" content="https://example.
</url> com/image.jpg" />
</urlset> <meta property="og:url" content="https://example.
* A sitemap cannot contain over 50,000 URLs. com" />
Large websites should use multiple sitemaps <!-- Optional Open Graph data -->
listed under a single sitemap index file. <meta property="og:audio" content="https://example.
com/guide.mp3." />
<meta property="og:description" content="Description
Sitemap Index File Other Common Sitemap Types: here." />
<meta property="og:site_name" content="Your Site
<?xml version="1.0" encoding="UTF-8"?> Name, i.e. Moz" />
• Images <meta property="og:locale" content="en_us" />
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap> <meta property="og:video" content="https://example.
• Video
<loc>https://example.com/sitemap1.xml.gz</loc> com/guide.mp4" />
<lastmod>2019-01-01T18:23:17+00:00</lastmod> • News <meta property="fb:app_id" content="Your FB_APP_ID" />
</sitemap> <!-- Find additional markup on https://ogp.me -->
<sitemap>
<loc>https://example.com/sitemap2.xml.gz</loc>
* Don't forget to submit your sitemap to Google <!-- Twitter Card data -->
<lastmod>2019-01-01</lastmod>
via Google Search Console. <meta name="twitter:card" content="summary">
</sitemap> <meta name="twitter:site" content="@Moz">
</sitemapindex> <meta name="twitter:title" content="Title of content
(max 70 characters)">
<meta name="twitter:description" content="Descrip-
tion of content">
<meta name="twitter:image" content="https://example.
com/unique-image.jpg">
Mobile Best Practices
Best Practices
There are 3 ways to implement a mobile website: • Your mobile version should display the same content as your
desktop site
• Responsive web design (adjusts for screen size) • Page title tags & meta descriptions should remain the same Default to Open Graph
Platforms that support Open Graph protocol include Facebook,
• Dynamic serving (serves different content based on • Use the meta name="viewport" tag in the head of your page Twitter, LinkedIn, and Pinterest.
a user’s device) to tell the browser how to adjust the content.
Separate URLs (different URLs that serve mobile-optimized For example: <meta name="viewport" content= Optimal Image Sizing
content). Not advised. "width=device-width, initial-scale=1.0"> Twitter:
• Minimum 144x144 px
Check to see if your site is mobile-friendly: Increase speed by optimizing the critical rendering path, • No larger than 4096x4096 px or 5MB
mz.cm/mobile-friendly using HTTPS & HTTP/2, eliminating render-blocking resources,
removing unused CSS, and deferring offscreen images. Facebook:
• Minimum 600x600 px
More information at mz.cm/mobile-seo • Try to use images that are at least 1080 px in width

More information at mz.cm/social-meta

| The Web Developer’s SEO Cheat Sheet | v5.0 | moz.com | Copyright 2020 © Moz, Inc. 3
Rich Snippets and Structured Data
Enhance search results and help search engines understand your content.

Common Vocabularies: schema.org Common Structured Data Types:


• Local business • Product
Popular Formats: JSON-LD, RDFa, Microdata
• FAQ page • Article
• Person • Recipes
Breadcrumbs
• How to • QApage
<script type="application/ld+json">
{ More information at mz.cm/rich-snippets
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
<---Repeat markup for additional list items--->
"@type": "ListItem", Security
"position": 1,
"item": {
"@id": "http://example.com/dinner",
"name": "Dinner" } When using target="_blank" to open a link in a new tab, make sure you're implementing
},
<---Additional list items here---> rel="noopener"
}] or
}</script>
rel="noreferrer" to avoid exposing your website to a surface attack.

SSL certificates are table stakes today. Your website must have one.
Reviews
Lighthouse (mz.cm/lighthouse) helps to identify these vulnerabilities (and more) in the audit.
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Review",
"reviewBody": "The restaurant has great ambiance.",
"itemReviewed": {
"@type": "Restaurant",
"name": "Fine Dining Establishment"
},
"reviewRating": {
"@type": "Rating",
"ratingValue": 5,
"worstRating": 1,
"bestRating": 5,
"reviewAspect": "Ambiance"
}
}
</script>

Review stars won’t show up in search results.

“Targeting Multiple Languages” next page

| The Web Developer’s SEO Cheat Sheet | v5.0 | moz.com | Copyright 2020 © Moz, Inc. 4
Targeting Multiple Languages
Help search engines understand your location/language targets.

URL Structures for Country & Language Targeting Popular Languages Popular Regions

ccTLDs (Country-Level Only): example.de en English US United States

Subdirectories with gTLDS: example.com/de/ es Spanish GB Great Britain

Subdomains with gTLDS: de.example.com/ zh Chinese CN China


hi Hindi IN India

rel="alternate" hreflang="x" ja Japanese JP Japan

Annotate alternate language & region versions of content


More language codes can be found at More region codes can be found at
mz.cm/langcodes mz.cm/regcodes
HTML version in <head>
Each version must identify all versions, including itself

<link rel="alternate" hreflang="x-default" href="http://example.com/" /> (Specifies


Default)
<link rel="alternate" hreflang="en" href="http://example.com/en/" /> (Specifies Lan-
guage; English)
<link rel="alternate" hreflang="en-GB" href="http://example.com/en-gb/" /> (Speci-
fies Language + Region)

Sitemap Version
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>http://example.com/english/</loc>
<xhtml:link rel="alternate" hreflang="de" href="http://example.com/deutsch/" />
<xhtml:link rel="alternate" hreflang="en" href="http://example.com/english/" />
</url>
<url>
<loc>http://example.com/deutsch/</loc>
<xhtml:link rel="alternate" hreflang="en" href="http://example.com/english/" />
<xhtml:link rel="alternate" hreflang="de" href="http://www.example.com/deutsch/"
/>
</url>
</urlset>

“Performance” next page

| The Web Developer’s SEO Cheat Sheet | v5.0 | moz.com | Copyright 2020 © Moz, Inc. 5
Performance

Page Speed Image Optimization


The most common culprit of poor page speed is images!
Page Speed Tips:
Image Optimization Tips:
• Compress and minify your code
• Compress your images & experiment with quality settings
• Reduce page redirects
• Remove unnecessary image metadata
• Remove render-blocking JavaScript
• Explore lazy loading
• Use treeshaking
• Leverage SRCSET for different screen sizes
• Leverage browser caching
• Ensure that your images have alt text
• Use a CDN
• Invest in automated tools that can help ensure your image assets will always
• Leverage preconnect, prefetch and preload
be optimized (example: mz.cm/imageopt)
• Analyze your critical rendering path performance for additional opportunities
in Chrome Dev Tools.

Test your Page Speed with:


Lighthouse: developers.google.com/web/tools/lighthouse
PageSpeed Insights: developers.google.com/speed/pagespeed/insights
Thanks for
GTmetrix: gtmetrix.com
WebPageTest: webpagetest.org reading!

Modern JavaScript Sites


JavaScript Tips:
• Keep JavaScript bundles small (especially for mobile devices). Small bundles improve
speed, lower memory usage, and reduce CPU costs.
• Use server-side or pre-rendering to improve site speed, user experience,
and crawler accessibility.
• Stuck with client-side rendering? Try pre-rendering to help Googlebot get a
more immediate HTML snapshot of your page.
• Use Chrome Dev Tools “Performance” tab to test your runtime performance
and network “throttling” to simulate different device capabilities.

Explore Chrome DevTools’ Timeline & JavaScript Profiler to analyze the impact
of your JavaScript.

| The Web Developer’s SEO Cheat Sheet | v5.0 | moz.com | Copyright 2020 © Moz, Inc. 6

You might also like