PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

How do you show page title when using a masthead include?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do you show page title when using a masthead include?

    Hello
    While testing the search engine each result shows no page title. I am using includes and the first thing on each page is the masthead include which contains the menu. It doesn't have the page title, as this obviously needs to be different for each page. I have used a template for the body of each page. At the top of the template is the include script for the mast so this is the first thing that appears on the page. There is no title in the head tag of the page. Then my template main body appears with a head tag including the page title. Is there any way around this?
    Regards

  • #2
    The HTML standard requires the title tag to be within the <head> section of the HTML. It is invalid for a <title> tag to be found within a <body> tag.

    The proper way to fix this would be to change your header / masthead script to determine the title correctly (eg. from a database) and write the corresponding title tag for the current page.

    Another option is to move the include for the masthead further down on the template page instead of it being the first thing on the page. That way, you can specify some head tags, meta tags, etc. which are unique to the page before you include the masthead. eg.

    Code:
    <html>
    <head>
    <title>my page</title>
    <meta name="description" content="this is my unique page description">
    </head>
    <body>
    
    ...rest of my page continues here...
    </body>
    </html>
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment

    Working...
    X