Site structure with includes

Asked

Viewed 36 times

1

Good morning guys. I’m developing a new site but I have a question here regarding the structure because of google. I will explain. The structure of the pages of the site is being through includes, as in the file "wood.php" below. That is, I’m assembling all the content of this page calling other pages including body through includes. My question is: will google index all the files correctly? That is, can it show in the results both the main page I called "wood.php" and her body I made separately "body-wood.html"? This won’t hurt me, since I want it to show only the main page which is wood.php? If it has become complicated the explanation question there that I clarify better.

<!DOCTYPE html>
<html lang="pt-br">

  <head>
    
  <?php
   
include "head.html"
?>
    <title>Titulo do site</title>
  </head>
  <body style="font-family: comfortaa;">

<!-- puxa o header, ou seja, o menu do seu website -->
<?php
include "header.html"
?>

<!-- puxa o body da pagina teste -->
<?php
include "madeira-body.html"
?>

<!-- puxa a páกgina footer, ou seja, o final do website -->
<?php
include "footer.html"
?>
</body>
</html>

  • It will index only one page, the one that makes the includes

  • Unless the others are available for listing, then he’ll see the main and the others

1 answer

1


Opa,

Google will index only the pages you have it indexed. You can control this with the ROBOTS.TXT file that should be in the root folder of the project, in which you will define what google is allowed to read or not.

As you are building an entire page by include, google will interpret this page as unique, because in the "compiler" of the browser will be displayed the page as unique, because each include contains the elements of HTML.

For organization reasons, include files I usually put them in a unique folder (suppose it is named "INCLUDES"). So, in your robots.txt, you inform that the INCLUDES folder is blocked (disallow) so that google can’t read or find it. This way, all files inside this folder will not be indexed.

By doing this, your includes will be called in your main file that you will display your site/system normally, and google will index as if it were a single page.

I hope I’ve helped.

Learn more about robots.txt: https://support.google.com/webmasters/answer/6062596?hl=pt-BR

  • 1

    If the page is not in robots.txt and is linked by a a in another location, google will see, it goes from link to link and index, so it is important to only allow the listing of files that need to be viewed

  • 1

    Yes, exactly Denis, so I usually put the include files inside a unique folder, because they are "broken" files that will be joined to form a content.

Browser other questions tagged

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