Meta tag helps

Discussion in 'Search Engine Optimization' started by crazyryan, Nov 28, 2006.

  1. #1
    ok, on my site I am using dynamic meta tags so basically..

    <meta name="keywords" content="boredombase, games, videos, pictures, funny videos, funny pictures, linerider, school games, games for school, {file[title]}" />
    <meta name="description" content="{file[description]}">

    Is my meta tag, firstly, for the keywords, on some occasions there is no title so the meta tag will end like school games, games for school, " with the , on the end before the ". Does this matter?

    Secondly, on some occasions there will be no description, so if the meta tag is <meta name="description" content=""> with nothing in it, will the search engines ignore this tag and base the description on the page content?
     
    crazyryan, Nov 28, 2006 IP
  2. disgust

    disgust Guest

    Messages:
    2,417
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    0
    #2
    why would you use content="" instead of just skipping out on the tag entirely? you can check in php if the variable is empty and if it is don't echo that part. that's what I'd do, personally.

    if you repeat your keywords a lot the only real risk is that of duplicate content. but if the content isn't borderline duplicate, it won't be an issue. vbulletin, out of the package, uses the same keywords on every page... and vb's get crawled fine.
     
    disgust, Nov 28, 2006 IP
  3. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #3
    I was going to, but I have no idea how to do it.
     
    crazyryan, Nov 28, 2006 IP
  4. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Come on Ryan, you;ve been playing around with PHP long enough now...

    
    $meta_keywords = '<meta name="keywords" content="boredombase, games, videos, pictures, funny videos, funny pictures, linerider, school games, games for school';
    if (tep_not_null($file['title'])) {
    $meta_keywords .= ', ' . $file['title'];
    }
    $meta_keywords .= '">';
    echo $meta_keywords;
    
    if (tep_not_null($file['description'])) {
    echo '<meta name="description" content="' . $file['description'] . '">';
    }
    
    PHP:
    Using the function I pasted in the other thread.
     
    T0PS3O, Nov 28, 2006 IP
  5. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #5
    I have an excuse - school, lol. :(

    I seem to be getting an error on this line.

    if (tep_not_null($file['title'])) {

    Fatal error: Call to undefined function: tep_not_null() in /home/base/public_html/include.php on line 3
     
    crazyryan, Nov 28, 2006 IP
  6. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Did you put the function from the other thread somewhere near the top of the script?
     
    T0PS3O, Nov 28, 2006 IP
  7. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #7
    Yeah, but I just removed it and I still get the error.
     
    crazyryan, Nov 28, 2006 IP
  8. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Don't remove it, you need it.
     
    T0PS3O, Nov 28, 2006 IP
  9. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #9
    Oh haha.

    OK, I added back so my code is now:
    
    <?php
    $description = $file['description'];
    
    if($description == ''){
    $description = "description was empty";
    }
    $meta_keywords = '<meta name="keywords" content="boredombase, games, videos, pictures, funny videos, funny pictures, linerider, school games, games for school';
    if (tep_not_null($file['title'])) {
    $meta_keywords .= ', ' . $file['title'];
    }
    $meta_keywords .= '">';
    echo $meta_keywords;
    
    if (tep_not_null($file['description'])) {
    echo '<meta name="description" content="' . $file['description'] . '">';
    }
    PHP:
    I still get the error on line 8 though.
    
    if (tep_not_null($file['title'])) {
    
    PHP:
     
    crazyryan, Nov 28, 2006 IP
  10. weknowtheworld

    weknowtheworld Guest

    Messages:
    306
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I'm learning... Never knew meta tags could be generated dynamically...

    Does dynamic generations have an added advantage??
     
    weknowtheworld, Nov 28, 2006 IP
  11. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #11
    Nope not really, apart from the meta tags are automatically created based on my file title and description etc.
     
    crazyryan, Nov 28, 2006 IP
  12. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Dude, read my posts in the other thread. You still don't have the funtion, you pasted another suggestion from that thread. Pick one or the other but like this it won't work. If you want my code from this thread to work, go to the other thread and paste the "function tep_not_null($value) {...etc" towards the top.

    EDIT: http://forums.digitalpoint.com/showpost.php?p=1827474&postcount=4 that code
     
    T0PS3O, Nov 28, 2006 IP
  13. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #13
    Sorry, I didn't realise you meant that :p

    OK, I done that and it got rid of the errors, however it only showed the keywords meta tag and didn't show the file title.
     
    crazyryan, Nov 28, 2006 IP
  14. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #14
    I came up with a fix. I included {filemeta} and {indexmeta} in my header, but only pulled {filemeta} on the display page file so it was ignored on index and all the other pages apart from the file page.

    Thanks for help guys :)
     
    crazyryan, Nov 29, 2006 IP