Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Posts
    133
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Is this header right? (meta tags)

    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?

    Thanks for the help.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta http-equiv="Content-Language" content="EN-US">
    <meta name="Copyright" content="&copy; 2012 ERBoH.com">
    <meta name="Description" content="Discussion forum, news, fan activities, contests, and hints to who will be in the next ERB!"/>
    <meta name="keywords" content="Epic Rap Battles of History, nicepeter, epiclloyd, epic rap battle" />
    <title>Epic Rap Battles of History Fansite</title>
    <link href="/style.css" rel="stylesheet" type="text/css" />
    </head>

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    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.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    Quote Originally Posted by njfail View Post
    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-language meta elements are disallowed in HTML. Use the lang attribute on the html element to declare the document's language.

    Quote Originally Posted by njfail View Post
    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 View Post
    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 description meta elements should reflect their respective page. Google uses both of these in its search results.

    The keywords meta 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).

    Example revised code:
    Code:
    <!doctype html>
    <html lang="en-US">
    	<head>
    		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    		<title>Epic Rap Battles of History Fansite</title>
    		<!-- Copyright © 2012 ERBoH.com -->
    		<meta name="description" content="Discussion forum, news, fan activities, contests, and hints to who will be in the next ERB!">
    		<meta name="keywords" content="Epic Rap Battles of History, nicepeter, epiclloyd, epic rap battle">
    		<link rel="stylesheet" href="/style.css">
    	</head>
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,608
    Thanks
    0
    Thanked 645 Times in 635 Posts
    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.
    Last edited by felgall; 01-20-2012 at 07:37 PM.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    Regular Coder
    Join Date
    Aug 2010
    Posts
    133
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Arbitrator View Post
    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-language meta 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 description meta elements should reflect their respective page. Google uses both of these in its search results.

    The keywords meta 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).

    Example revised code:
    Code:
    <!doctype html>
    <html lang="en-US">
    	<head>
    		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    		<title>Epic Rap Battles of History Fansite</title>
    		<!-- Copyright © 2012 ERBoH.com -->
    		<meta name="description" content="Discussion forum, news, fan activities, contests, and hints to who will be in the next ERB!">
    		<meta name="keywords" content="Epic Rap Battles of History, nicepeter, epiclloyd, epic rap battle">
    		<link rel="stylesheet" href="/style.css">
    	</head>
    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?

  • #6
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,608
    Thanks
    0
    Thanked 645 Times in 635 Posts
    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.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #7
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    Quote Originally Posted by njfail View Post
    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 View Post
    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 View Post
    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 View Post
    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++).
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #8
    Regular Coder
    Join Date
    Aug 2010
    Posts
    133
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks arbitrator that was very helpful
    I understand it a lot more now.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •