4

Consider the HTML5 tag named link. Is this relevant to web-crawlers?

<head>
    <link rel="import" href="/path/to/imports/stuff.html">
</head>

Say there are images in this linked import, will those appear under the parent's URL or the linked content's URL?

I would ultimately like to have them included in the parent's URL.

3

Generally when you use link rel="import" for <body> elements you will use some way of calling for those elements to be displayed. One method that I'm aware of its using JavaScript with something like:

Source

<head>
  <link rel="import" href="import.html">
</head>
<body>
  <div id="container"></div>
  <script>
    var link = document.querySelector('link[rel="import"]');

    // Clone the <template> in the import.
    var template = link.import.querySelector('template');
    var clone = document.importNode(template.content, true);

    document.querySelector('#container').appendChild(clone);
  </script>
</body>

Using the above method would insert the content into the <div id="container"></div>. Google understands most simple JavaScripts that load resources through using the DOM and because you are embedding the image on the parent page Google will assoicate that page with that image... However one thing you might want to do to prevent Google indexing import html files is using a noindex and a block using robots.txt

  • 1
    FWIW if you block import.html via robots.txt, then that would also prevent its content from being picked up for indexing at all (even when pulled in via JavaScript like this). You can test this with "Fetch as Google" using the rendered option, in Webmaster Tools. – John Mueller Dec 24 '14 at 8:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.