H
H
hckn2018-08-30 23:34:51
Search Engine Optimization
hckn, 2018-08-30 23:34:51

How to insert text in SVG for SEO crawler?

I have a logo on my site

<h1>
  <svg></svg>
<h1/>

Those. just picture in h1.
I am not very familiar with SVG, but I have seen that they often write text directly there, almost title
How to write text in SVG:
1. invisible to users, i.e. existing only in markup
2. so that bots can read it by executing it document.querySelector('h1').innerText
3. so that the code remains valid in terms of the HTML specification

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny, 2018-08-31
@hckn

As innerText, no way.
SVG is ordered by other validation algorithms relative to HTML markup, so ...
Purely theoretically, you can try to use h1 directly in the SVG markup and, if it is written as it is, and not through, for example, Embed, it will be read.
But there is an opinion that you just want to force search engine to see the text. If so:
1. Don't use the logo in h1
2. Use img object which will suck the svg file. And here already use alt and title
Well, the main thing, I agree with the speaker in the comments: the request was made incorrectly. And the task, most likely, is also set.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question