Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

SEO and generic header files

Options
  • 26-09-2007 10:22am
    #1
    Closed Accounts Posts: 975 ✭✭✭


    I use generic headers and footers in every project. Along with css, reusable code snippets and formatted code, they save me a lot of time. Of course with this approach my page title and meta tags are the same throughout the site, which is an SEO no-no.

    1) For static sites I guess I could have 2 header files - a generic one containing banners and common info, and one which is unique for each page containing title and meta tags. Is there a better way?

    1) For dynamic pages, I'm thinking I could retrieve the info from the db and use mod_rewrite to let me show a meaningful url. So if I had a db with id, title, story, the title would come from the title in the db, the description tag could come from the first sentence of the story, and I could print the url link in the format "my_article_title_id.php", and mod_rewrite could parse this (it would only need the id portion to resolve to mystory.php?story=id). Again, I would appreciate the benefit of the experience of others who have come across these problems.


Comments

  • Registered Users Posts: 11,987 ✭✭✭✭zAbbo


    You could just exclude the custom elements from your header file
    [PHP]<!--#include file="header_1.html" -->
    <!--START CUSTOM HEAD CONTENT -->
    <title>Custom Title</title>
    <!--_END CUSTOM HEAD CONTENT -->
    <!--#include file="header_2.html" -->[/PHP]

    Depends on the site, scripting, size, dynamic etc.


  • Closed Accounts Posts: 975 ✭✭✭squibs


    Yep - thats another spin on it.


  • Registered Users Posts: 568 ✭✭✭phil


    Along the line of what zabbo posted, what would be better is to use some sort of structured template system.

    Most templating systems will allow you to pass variables in as you're including. Smarty is an example of a PHP based templating system. Appropiate ones may depend on your current knowledge base, platform and available technologies.

    HTML authoring can take a lot of principles from normal software development about code re-use, templating, etc. If you're working with this stuff on a daily basis, learning how to work a good templating system will eventually save you a lot of time, especially if you're inventive with how you apply them.


  • Closed Accounts Posts: 17 WPI20000


    Why don't you simply put all the stuff you need in META tags?


  • Registered Users Posts: 3,594 ✭✭✭forbairt


    WPI20000 wrote:
    Why don't you simply put all the stuff you need in META tags?

    he / she is using one template for all the pages ... I'm guilty of it myself cus its just damn handy at times ... on small jobs ...

    As such you're already loading this before you really start to deal with the actual page article / content ... so you don't know what meta / titles to put in ...


  • Advertisement
  • Registered Users Posts: 7,739 ✭✭✭mneylon


    WPI20000 wrote:
    Why don't you simply put all the stuff you need in META tags?
    Because he's using a system that uses a default header on all pages?

    He's trying to find a better way of doing it


  • Closed Accounts Posts: 17 WPI20000


    forbairt wrote:
    he / she is using one template for all the pages ... I'm guilty of it myself cus its just damn handy at times ... on small jobs ...

    As such you're already loading this before you really start to deal with the actual page article / content ... so you don't know what meta / titles to put in ...
    This is a pretty easy solution.

    1. Put a Javascript at the bottom of the page.
    2. When the browser get to the script it makes it load
    3. The script can then parse the DOM and insert any SEO you need.

    Very quick to do this too.


  • Registered Users Posts: 3,594 ✭✭✭forbairt


    WPI20000 wrote:
    This is a pretty easy solution.

    1. Put a Javascript at the bottom of the page.
    2. When the browser get to the script it makes it load
    3. The script can then parse the DOM and insert any SEO you need.

    Very quick to do this too.


    great for SEO ... now how many search engines are running bots that deal with javascript ?


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    zabbo wrote:
    You could just exclude the custom elements from your header file
    [PHP]<!--#include file="header_1.html" -->
    <!--START CUSTOM HEAD CONTENT -->
    <title>Custom Title</title>
    <!--_END CUSTOM HEAD CONTENT -->
    <!--#include file="header_2.html" -->[/PHP]

    Depends on the site, scripting, size, dynamic etc.

    That's along the lines of what I did on an ASP based site, in my header include file I just had something like this

    header.asp:
    <title><%=sPageTitle%></title>
    <meta name="keywords" content="<%=sKeyWords%>" />
    

    and just specified the variables in each page before I included the file - though they were retrieved from a database in the live example.
    <%
    sTitle = "Title for this page"
    sKeywords = "keywords here"
    %>
    <!--#include file="header.asp"-->
    


  • Closed Accounts Posts: 975 ✭✭✭squibs


    Yeah - thats kinda where I'm headed. I'm also using mod rewrite to display article title and id taken from the db in displayed urls. The rewrite rule just dumps the title and uses the id. Of course now I need to roll this out across 24 sites. See you all in a few weeks...


  • Advertisement
  • Registered Users Posts: 145 ✭✭RedCardinal


    WPI20000 wrote:
    This is a pretty easy solution.

    1. Put a Javascript at the bottom of the page.
    2. When the browser get to the script it makes it load
    3. The script can then parse the DOM and insert any SEO you need.

    Very quick to do this too.
    OK - you're definitely a plant. If you had just kept a little more quiet you might just have gotten away with http://webpageireland.com/

    There's no way that someone who knows about DOM put up that complete sh1te AND knows how to give the worst SEO advice in the world.

    If you are for real God help us all. But you seem to have forgotten to mention SEO on our services page?


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    WPI20000 wrote:
    This is a pretty easy solution.

    1. Put a Javascript at the bottom of the page.
    2. When the browser get to the script it makes it load
    3. The script can then parse the DOM and insert any SEO you need.

    Very quick to do this too.

    You may as well send an email to google with your keywords and ask them to put them up for you.


Advertisement