I'm not entirely sure what the differences between charsets and traditional, strict, etc.
I just kind of copied things from tutorials. Is this info right? Its a .php file.
What does the copyright meta tag do?
Also, should I leave the description/title the same for content pages and contact/about us/privacy policy pages?
Or should each have its own description? Does it make a difference as far as search engines are concerned?
Hello njfail,
A good place to start with questions like this is the validator. See the links about validation in my signature line.
Most of those meta tags are hardly necessary though you do need a character declaration. I also think any new website should have strict DocType, not a transitional.
Location: Splendora, Texas, United States of America
Posts: 2,900
Thanks: 5
Thanked 188 Times in 185 Posts
Quote:
Originally Posted by njfail
I'm not entirely sure what the differences between charsets and traditional, strict, etc.
Just use <!doctype html> for the document type declaration to declare your document as HTML. It's easy to remember compared to the old declarations
For the character encoding ("charset"), you should save your documents as UTF-8 in your document editor (there should be an option when you use the "Save As" command), and then label them as such. This is the preferred character encoding.
content-languagemeta elements are disallowed in HTML. Use the lang attribute on the html element to declare the document's language.
Quote:
Originally Posted by njfail
What does the copyright meta tag do?
It doesn't do anything. There is not such a thing defined in the specification either. Put the information in a comment declaration if it really needs to be there.
Quote:
Originally Posted by njfail
Also, should I leave the description/title the same for content pages and contact/about us/privacy policy pages?
Or should each have its own description? Does it make a difference as far as search engines are concerned?
The title and descriptionmeta elements should reflect their respective page. Google uses both of these in its search results.
The keywordsmeta element is still valid in HTML, but it is mostly useless since search engines don't use them due to author abuse.
There's also no need to declare the MIME type of your link element since the default type is text/css (though it doesn't hurt).
The HTML 4 strict doctype indicates that you are using HTML 4 and do not have any old HTML 3.2 tags in your page.
The HTML 4 transitional doctype indicates that you still haven't finished getting rid of the tags that were allowed in HTML 3.2 but which were removed in HTML 4 in 1997 because there are better alternative ways to do those things in HTML 4. (Note that while HTML 4 became a standard in 1997, it wasn't fully supported by all browsers until about 2005 and so sites that were created before 2005 had to use transitional - only hobbyists have continued to create new transitional sites since then).
Specifying a doctype without including the version of HTML simply indicates that the version is HTML 2 or greater (since HTML 1 wasn't defined using SGML and so doesn't use an SGML doctype to identify the standard SGML definition of the language).
Any meta http-equiv would be better done server side before sending the page rather than including it in the HTML and hoping that the browser can update the specified setting after it has already started loading the page.
Unless you have code of your own that reads the meta keywords tag you may as well omit that one as the search engines no longer use it at all.
Just use <!doctype html> for the document type declaration to declare your document as HTML. It's easy to remember compared to the old declarations
For the character encoding ("charset"), you should save your documents as UTF-8 in your document editor (there should be an option when you use the "Save As" command), and then label them as such. This is the preferred character encoding.
content-languagemeta elements are disallowed in HTML. Use the lang attribute on the html element to declare the document's language.
It doesn't do anything. There is not such a thing defined in the specification either. Put the information in a comment declaration if it really needs to be there.
The title and descriptionmeta elements should reflect their respective page. Google uses both of these in its search results.
The keywordsmeta element is still valid in HTML, but it is mostly useless since search engines don't use them due to author abuse.
There's also no need to declare the MIME type of your link element since the default type is text/css (though it doesn't hurt).
I was told before that if its a .php file, then it shouldn't have html tags.
You suggest
Code:
<html lang="en-US">
So I assume it needs to be closed at the end of the file with
Code:
</html>
Is it ok to have this in a .php file?
The only php I actually have is
Code:
<?php include $_SERVER['DOCUMENT_ROOT'] . '/footer.php'; ?>
Which is the only php I know how to use
I only use it for the footer, since that stays the same no matter what. The meta tags (description) changes for each page so I don't use this php for that. I only have a few pages so its not a big deal. Do pages load faster if I put them in a .php file and link to them like above?
When using PHP it is what the final HTML that is delivered to the browser that is what matters when it comes to dealing with the HTML. How the HTML is generated inside the PHP doesn't matter to the browser as the browser only sees the final HTML.
Location: Splendora, Texas, United States of America
Posts: 2,900
Thanks: 5
Thanked 188 Times in 185 Posts
Quote:
Originally Posted by njfail
I was told before that if its a .php file, then it shouldn't have html tags.
I don't see why that would be the case.
Quote:
Originally Posted by njfail
You suggest
Code:
<html lang="en-US">
So I assume it needs to be closed at the end of the file with
Code:
</html>
Is it ok to have this in a .php file?
That should be fine unless you're already outputting the relevant tag somewhere else (in which case, you would have duplicate tags).
(The html element's tags are not strictly required; missing tags will be generated automatically for that element. However, it's good practice to use the tags; invisible element boundaries (i.e., tags) make for confusing code.)
Quote:
Originally Posted by njfail
The only php I actually have is
Code:
<?php include $_SERVER['DOCUMENT_ROOT'] . '/footer.php'; ?>
Make sure that the footer.php file does not include a </html> tag.
Quote:
Originally Posted by njfail
Do pages load faster if I put them in a .php file and link to them like above?
I'd guess that pages will load slower because your server must combine files before it responds to to the user's original file request. I'd expect any server-side processing action to slow down your pages.
Of course, putting the footer in its own file will probably save you editing time, so you'll have to weigh the benefits. If you really only have a few pages, you might want to avoid server-side includes; you can update all footers (in multiple files) at once by using a find-and-replace-in-files operation if you use an HTML editor that supports it (like Notepad++).
__________________
Please for the love of god stop making IE. You current "browser"s cause me to cry every day. —Phil *