Are search engines going to see my dynamically created content in Bootstrap tabs?

I have a page index.php with 3 Bootstrap tabs in it, and for each tab I am generating its content after user clicks on it.
For example:

  • when page is loaded I will execute SQL query that will get data from database only for first tab.
  • when user clicks on the second tab, I am executing a query that will take data and display it in selected tab.

Is this good approach? Is Google going too see all that data when it index the page containing all this tabs? I do not want to pull all data at once because of performance issues.

Here is my sample code, so please tell me if this is a good approach:

index.php file:

<!DOCTYPE html>
    <title>Tabs demo</title>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="">
    <div class="container">
        <ul class="nav nav-tabs">
            <li class="active"><a data-toggle="tab" href="#home">Home</a></li>
            <li><a data-toggle="tab" href="#menu1">Menu 1</a></li>
            <li><a data-toggle="tab" href="#menu2">Menu 2</a></li>
        <div class="tab-content">
            <div id="home" class="tab-pane fade in active">
                <p>Some content.</p>
            <div id="menu1" class="tab-pane fade">
                <?php $model = [
                    0 => ['title' => 'First item', 'content' => 'Some first content'],
                    1 => ['title' => 'Second item', 'content' => 'Some second content']
                ]; ?>
                <?php foreach ($model as $data): ?>
                    <h3><?= $data['title'] ?></h3>
                    <p><?= $data['content'] ?></p>
                <?php endforeach ?>
            <div id="menu2" class="tab-pane fade">
                <h3>Menu 2</h3>
                <p>Some content in menu 2.</p>
<!-- jQuery library -->
<script src="//"></script>
<!-- Latest compiled and minified JavaScript -->
<script src=""></script>

I am afraid that search engines will not see second and third tabs contents. Or at least they will not relate them with index.php page. Am I wrong?



No, we (Google) won't see the content behind tabs iff the content under the tab is dynamically generated (i.e. not just hidden).

You can also see what we "see" using Fetch as Google in Search Console (former Webmaster Tools); read more about the feature in our post titled Rendering pages with Fetch as Google.


The best aproach is to design the website to work without javascript, and just replace all your anchor elements that work with ajax to pass a GET variable to your web controller, so it knows to return just the html to be inserted with javascript.


If you are using JS/AJAX, (I don't really see any, but I can't think of a better alternative) you are going to have a hard time getting Google to index your pages. Google has a good documentation on this that has helped me in the past on projects with similar goals.

Is it really that big of a deal to not load the content until the tab is clicked? Unless you are working with an un-cacheable constantly updating database and massive HTML output that would create a long flash of unstyled content I would say splitting the tabs view code is somewhat trivial.


Maybe this can help:

If your problem is performance, it's maybe because you have strong DB queries or a shared server. If not, please ignore this.

When loading the whole page, put a "fake" HTML code in each tab. Try to build the HTML code shaped as the real code that is loaded when each tab is clicked. Put all of this inside an invisible DIV. Each time the page is loaded, put also some random data (maybe a 16-chars random-generated string). In this way I think Google will spider your data more frequently (this doesn't happen for static content).



Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.