The search engines do not index images with JavaScript

GK User
Fri Oct 14, 2016 7:59 am
Hi!

Google and Yandex do not index images with class=gk-wide-image. This website indexed images without Javascript and backgrounds-images. Bing does not show all the images, but it is not very important for me.
For I did Google images-sitemap but the result is not yet see.
In Yandex sitemap for images can not be created. But Yandex webmaster panel shows a 404 error on the path to image files. Although the links to images is absolutely correct and display issues no site.
Аdvise how do I solve the problem without abandoning JavaScript-output images?

My site https://belenkina.ru/

Regards,
User avatar
Fresh Boarder

teitbite
Fri Oct 14, 2016 12:24 pm
Hi

Slider and header images are presented as background, so may not be caught by robots. Changes to template's code may be required. What type of articles are You using? Joomla or K2?
User avatar
Moderator

GK User
Fri Oct 14, 2016 12:45 pm
I am interested in the content K2.
User avatar
Fresh Boarder

teitbite
Sat Oct 15, 2016 6:28 pm
Hi

Depending on the K2 template You are using (portfolio or portfolio-grid) edit file /html/com_k2/templates/[name of tempalte]/item.php and add this code on top of the file:

Code: Select all
<?php if( $this->item->image ): ?>
$doc =& JFactory::getDocument();
$doc->setMetaData( 'og:image', $this->item->image, true );
<?php endif; ?>
User avatar
Moderator

GK User
Sun Oct 16, 2016 7:09 pm
Hi

Did I put your code is not exactly where to go.
Please tell me exactly where to insert it..

Sorry my bad english,
Maybe You did not understand me but I'm interested in is the indexation of images in the content of K2-item.
Code: Select all
<p class="gk-wide-image" data-sr="enter bottom and move 200px and scale up 20% over 1s"><img src="images\site\portfolio\GK_Dom_na_Begovoy\living_room2.jpg" alt="Жилая комната. Вид2" /> <small>Жилая комната. Вид2</small></p>

I want indexed images displayed through class = "gk-wide-image"
I was not very interested in the indexing of the background image header.

I have not seen a difference in a html-code, which should affect the ability to index images in the content.
I edited /html/com_k2/templates/portfolio-grid/item.php. I use template K2 Portfolio-grid

Regards
User avatar
Fresh Boarder

teitbite
Mon Oct 17, 2016 11:28 am
Hi

Can You please tell me the exact url to the page where You've copied this piece of code from ? Is it an image added as a content of an article ?

Maybe it can be resolved by javascript:

Code: Select all
<script type="text/javascript">(function($) {$(document).ready(function() {
$('.gk-wide-image img').each(function(){
$('head').append('<meta name="og:image" content="'+$(this).attr('src')+'">');
});
});})(jQuery)</script>
User avatar
Moderator

GK User
Mon Oct 17, 2016 12:59 pm
Hi
1. Link https://belenkina.ru/portfolio/trekhkomnatnaya-kvartira-v-zhk-dom-na-begovoj. Added php-code in the file item.php
Code: Select all
<?php if( $this->item->image ): ?>
$doc =& JFactory::getDocument();
$doc->setMetaData( 'og:image', $this->item->image, true );
<?php endif; ?>

2.ЯI do not understand where to insert Javascript?I inserted in the beginning and at the end of item.php.
3.You propose to add markup Open Graph?
Maybe you advise some sort Joomla-plugin for Open Graph
User avatar
Fresh Boarder

teitbite
Thu Oct 20, 2016 2:02 pm
Hi

1. I can see it worked, there is an image in meta tagsnow:

Code: Select all
<meta property="og:image" content="https://belenkina.ru/media/k2/items/cache/97a787f8d6fb66aaef15fa858aa433ea_S.jpg">


2. Any place should be good, since the script I gave You is waiting for the site to be loaded first. Hm, now I'm not sure which solution added meta tags now, but I can see it working.

3. I like the plugin proposed by Phoca: http://www.phoca.cz/phoca-open-graph-plugin
User avatar
Moderator


cron