Google AMP - Link

The Link tag in amp is used to tell the Google search engine about the amp and non-amp pages available. In this chapter, let us discuss in detail the aspects involved with Link tag and how google decides about the amp-page and non amp-page.

AMP Page Discovery

Consider you have a site called The news article links to the page −

When a user searches in the Google search engine and happens to get the non amp-page, in order to also get reference to the amp page, we need to specify the amp url using the link tag as shown below −


Page-url for Non amp-page

<link rel = "amphtml" href = "">

Here rel= ”amphtml” is specified for a non amp page to point to the amp version, so that Google shows the right one based on platform

Page-url for amp-page

<link rel = "canonical" href = "">

Here rel=”canonical” is specified in amp page to point to the standard version of html, so that Google shows the right one based on platform.

Incase your site has only one page, which is an amp page, you should still not forget to add the rel=”canonical” which will point to itself −

<link rel = "canonical" href = "">

The following diagram shows a reference to rel=”amphtml” pointing to amp page and rel=”canonical” pointing to standard html page.

AMP Html

Fonts Using Link

Fonts can be loaded externally using link as shown below −

<link rel = "stylesheet" href = "">

Note that only whitelisted origins are allowed. The list of whitelisted origin where we can get the fonts is as shown here −

  • −

  • Google Fonts −

  • Font Awesome −

  • Typekit − (replace kitId accordingly)

A working example using rel=”canonical” and rel=”stylesheet” is shown below −


<!doctype html>
<html amp>
      <meta charset ="utf-8">
      <title>Amp Sample Page</title>
      <link rel = "canonical" href = "amppage.html">
      <meta name = "viewport" content = "width = device-width,minimum-scale=1,initial-scale = 1">
      <style amp-custom>
         h1 {color: red}

      <style amp-boilerplate>
            -amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:
            -amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:
            -amp-start 8s steps(1,end) 0s 1 normal both;animation:
            -amp-start 8s steps(1,end) 0s 1 normal both

         <style amp-boilerplate>
      <script async src = ""></script>

      <link rel = "stylesheet" href = "">
      <h1>Amp Sample Page</h1>
         <amp-img src = "images/christmas1.jpg" 
            width = "300" height = "250" 
            layout = "responsive">

      <p style = "font-family: 'Roboto'; font-size:25px;">
         Welcome to Amp Page


The output of the code shown above is as shown below −

Fonts Using Link
Kickstart Your Career

Get certified by completing the course

Get Started