Do searchers interpret the elements before or after rendered by Javascript?

Asked

Viewed 51 times

2

For example, in a ng-repeatangular or in single append of Jquery, searchers will read all elements created dynamically, since it is a replace client-side?

In the section below, taking the example of Jquery, I have a div.blockquote which will be replaced by a real tag <blockquote> as well as its content that, as it is in a predefined format, will be divided into several tags so that the semantics is preserved. Searchers will take this new tag and their "daughters into consideration"?

(function blockquote(){
	$('.blockquote').each(function(i){
  	var self = $(this);
    var phrase = self.html().split(/---/)[0].replace(/\n/g, '<br>');
    var footer = self.html().split(/---/)[1];
    var autor  = footer.split('#')[0];
    var autorHref = footer.split('#')[1];
    var blockquote = $('<blockquote></blockquote>');
    var text = $('<p></p>');
    var line = $('<hr>');
    var footer = $('<footer></footer>');
    var cite = $('<cite></cite>');
    blockquote.insertAfter(self);
    text.appendTo(blockquote).html(phrase);
    line.appendTo(blockquote);
    footer.appendTo(blockquote).html(' - ');
    cite.appendTo(footer).html('<a href="'+autorHref+'" target="_blank">'+autor+'</a>');
    blockquote.find('br:last, br:first').remove();
    blockquote.children('p').prepend('<br>');
    self.remove();
  })
})();
* {
  margin: 0;
  padding: 0;
  border: 0;
  box-sizing: border-box;
}
blockquote {
  background: #fff;
  border-right: 10px solid #3c948b;
  position: relative;
  box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.1);
  margin: 20px auto;
  max-width: 600px;
  min-width: 200px;
}
blockquote p {
  padding: 15px;
  vertical-align: middle;
  font-size: 12pt;
  font-family: sans-serif;
  font-style: italic;
  margin-left: 30px;
}
blockquote:before {
  content: '"';
  font-size: 38pt;
  font-family: 'Impact', sans-serif;
  font-style: italic;
  color: #3c948b;
  top: 3px;
  left: 3px;
  position: absolute;
}
blockquote p:after {
  content: '"';
}
blockquote hr {
  width: calc(100% - 40px);
  background: #3c948b;
  height: 1px;
  float: right;
  margin-right: -2px;
  border: 0;
}
blockquote footer {
  padding: 10px;
  text-align: right;
  font-weight: bold;
  font-size: 11pt;
}
blockquote footer cite a {
  text-decoration: none;
  color: #3c948b;
}
blockquote footer cite a:hover {
  text-decoration: underline;
  color: #3c948b;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<br>
<div class="blockquote">
  A primeira condição para modificar a realidade consiste em conhecê-la. --- Eduardo Galeano # https://www.google.com/
</div>

  • 2

    I am not going to answer now due to lack of time to formulate a decent answer, but I will tell you that yes, Google indexes pages generated by javascript, however it is necessary to use the javascript "History API": https://developer.mozilla.org/en-US/docs/Web/API/History_API - as an example pushState.

  • @Guilhermenascimento, I will take a good look at this API while I await your reply. Thanks in advance.

  • 2

    @Guilhermenascimento, at least the Google Crawler behaves very well, even in percussion cases, as the following analysis tries to show: We Tested How Googlebot Crawls Javascript And Here’s What We Learned

  • @Tobymosque yes, exact google is the best, the Bing/yahoo (same engine) is +or-, but also works. Great link.

  • @Tobymosque, really, great link. Thank you!

  • In general, search engines will see that it is not Javascript and may assume that the DOM will change. Proper meta tags are important as well.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.