1

I have a site on which I want to generate many svg dynamically with JS.

I make them dynamically because they are like 20.000 and making them as real images on the server would be a nightmare...

So I was wondering if these images stamped as xml inside my html will ever be indexed by Google as images and as such also viewable in Image search mode..

Here is an Example of "image" in svg, it's a stupid example but it is for making clear what I mean by inline SVG:

<svg width="100" height="100">
<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
</svg>

or I could embed the SVG in an img tag:

 <img src='data:image/svg+xml;utf8,<svg xmlns="w3.org/2000/svg" xmlns:xlink="w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve" height="100px" width="100px"> <g>...</g></svg>' alt="" />
2

Google only indexes images that have direct URLs, so images that are dynamically generated on a page (svg or otherwise) would not be eligible to appear in results. They do not index data-URI images for image search.

I would consider rendering them server-side using something like NodeJS, or writing a script that will generate the directory of all 20,000 in one fail swoop.

| improve this answer | |
  • And what about embedding the svg in an img tag like so: <img src='data:image/svg+xml;utf8,<svg xmlns="w3.org/2000/svg" xmlns:xlink="w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve" height="100px" width="100px"> <g>...</g></svg>' alt="" /> Fonte: css-tricks.com/lodge/svg/09-svg-data-uris – Fabio Manzo Jun 23 at 15:34
  • Just updated my answer. Google needs a real URL to index an image, it can't be a data URI. – Maximillian Laumeister Jun 23 at 18:59

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.