I do not understand almost anything about PHP. Once a friend sent me a code that allowed me to separate my page into several parts and then get those parts back in case I change anything in the scripts and style sheets so I do not need to go page by page to change it again , this is include_once
of PHP.
Finally, I remember that I've read an article that said it's a good practice to add a descriptive title for each page of our site, for example "My site - Photoshop Tutorial" p>
Based on these two pieces of information, I came across a problem. I separated my site in two parts the header and footer, and just change main with the information I want:
<?php
include_once "./includes/header.php";
<!-- AQUI VAI MEU CONTEÚDO -->
include_once "./includes/footer.php";
?>
Only <title>
of the page is in the header (which is the default of all pages), and ends up being unique for the whole site. Thinking back home I found a solution, which is to use JavaScript to modify the title. I have a practice that is always put an H1 with the main subject of the site before starting the content, for example <h1>Contato</h1>
. The question is, does it influence something on the site? Be it in SEO or anything else? Is there any better way to do it?
This is the code I use to change the title:
var title = $('main').first('h1').text();
$('title').text('Meu site -' + title);