1

I've got a page, in which I have a preview of a document, as JPG. Also, I've got the content read of that image.

I am doing it like this, but I have no idea if this is a way Google won't hate me:

<div class="image-container">                        
   <img src="preview.doc.jpg" />
   <hidden style="display:none">
       Lots of text which is in preview.doc, but the image above actually 
says this text, but as an image because a word document 
cannot be shown in a browser,
but it's alot which I do not want to show to the user because the data in here is actually rendered nicely above 
as a word document with all styling.
   </hidden>
</div>

Is this the way to do it, or should I do it in another way?

7
  • Google doesn't see your C# code, only the HTML it produces. What is the HTML output of this code? Why do you think this code might cause problems?
    – John Conde
    Commented Oct 5, 2017 at 11:24
  • @JohnConde I'm not sure, but I want to check it. it's alot of text which is not shown to the enduser, but the content is shown in the image above. it's alot, but I'm not sure how to do this, maybe in a alt? i'm not sure.. I ain't no SEO expert tho :P Commented Oct 5, 2017 at 11:43
  • Google cares about content... code just helps Google understand its positioning, style and ux. You are scored on the render, not the pre-render. So a 1000 lines of code with the same output of 100 lines of code will be exactly the same in terms of SEO. Commented Oct 5, 2017 at 11:49
  • @SimonHayter I know it does, but this has alot of non-displayed content, because that content is actual content of the preview picture. my question is, is that a problem? Commented Oct 5, 2017 at 13:21
  • The example you gave will get you into trouble. However, this is not enough code to know the whole story. For example, JS code can make the hidden content available to the ordinary user. Any page that has hidden content that is not available to the user will be penalized and enough pages will penalize the site. If you are thinking this is a SEO tactic, think again. The hidden content will be ignored.
    – closetnoc
    Commented Oct 5, 2017 at 16:57

2 Answers 2

1

If you want to follow best practice as far as Google's Guidelines are concerned, you should be showing everyone the exact same content - users and bots alike. An alternative would be to place the content in HTML on the page, underneath the image, but use an accordion / dropdown / click to expand type thing so that the text would be "hidden" unless clicked on and won't affect the UX of the page.

1

It looks a bit long, but I suppose you could just drop it into the image's alt attribute.

<div class="image-container">                        
  <img
    src="preview.doc.jpg"
    alt="Lots of text which is in preview.doc, but the image above actually says this text, but as an image because a word document cannot be shown in a browser, but it's alot which I do not want to show to the user because the data in here is actually rendered nicely above as a word document with all styling."
  />
</div>

It's a bit tough not knowing the purpose of keeping the .DOC (instead of just pasting/formatting the content online) but this wouldn't be entirely out of the realm of use of alt attributes.

Unconventional? Sure. Better than a hidden DIV? I'd say almost certainly.

2
  • That said, I'd still cast my own vote for just converting to HTML. Commented Oct 5, 2017 at 19:11
  • it's data retrieval, they need to fill in a form, and will get the document afterwards as a download. but I want to document to be indexed. but not easily retrievable by the people Commented Oct 6, 2017 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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