Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Help! How do you add meta tags?

edited November 2006 in Vanilla 1.0 Help
I'd like to add meta tags to my site so I can promote it more. right now no one knows about it! HEEEELP go to www.realbraveaudio.com/vanilla thanks for your help

Comments

  • Options
    Many would say that there are better ways than meta tags to promote a site, but here is some sample code anyway:

    <?php /* Extension Name: Meta tags Extension Url: http://lussumo.com/community/discussion/3999/ Description: Simplistic extension example to add a meta tag to all or some pages. Version: 0.1 Author: WallPhone Author Url: http://edacio.us/ */ if(in_array($Context->SelfUrl, array('index.php', 'categories.php', 'comments.php', 'search.php', 'post.php', 'account.php', 'settings.php', 'people.php'))){ $Head->AddString('<meta name="description" content="Put your description here.">'); $Head->AddString('<meta name="keywords" content="type, your, keywords, here">'); } ?>

    If you want to customize the description and keywords based on the page, pull them out of that array, and put them in a new if block like so:
    if ( in_array($Context->SelfUrl, array('search.php')) ) { $Head->AddString('<meta name="description" content="Put your description for the search page here.">'); $Head->AddString('<meta name="keywords" content="type, your, search, page, keywords, here">'); } if ( in_array($Context->SelfUrl, array('index.php', 'categories.php')) ) { $Head->AddString('<meta name="description" content="Put your main & categories page description here.">'); $Head->AddString('<meta name="keywords" content="type, your, main, and categories, keywords, here">'); } ?>

    Name this file default.php and save it in a folder created in your vanilla's extensions folder, then enable it in the forum settings.

    If you just want the same meta tags site-wide, it might be easier to create a new theme file by editing the themes/head.php file.
  • Options
    cool. hey, i'd love to hear your thoughts on promotion techniques... I probably should have been more precise with the question... where does the meta tag info go. What file? I don't see a themes/head.php file. I don't see the file where I would input this info or the file where I would add the php link to. Thanks for your help!
  • Options
    The code I gave needs to be copied into a extension file (which means its named default.php, and placed in a folder inside Vanilla's extensions folder)

    The other way to do it, (not using an extension) is by creating a theme, which is where that head.php file would come in to play.

    You should only have to do it one of these ways.

    As far as promotion... I don't really know that much more about it. Many say linkbuilding/baiting is the best.
  • Options
    thanks- I'll check it out!
  • Options
    I think Meta Tags are good for promotion.
    There were developed to provide information about a website (that's why they called METAtags ;).
    They were used by search engines long time ago AFAIK. Especially Keywords and Description. But then came webmaster, who put all kinds of keywords in their metatags, so they were not useful anymore. So search engines switch to other methods. But MetatTags are still in use. For example shows google the Description text of my website, when it's in results.
    They are the first step of SEO if you ask me. Followed then by friendly URL's and then of course followed by linkbuilding/baiting.
    Furthermore MetaTags are also a sign of good neightborhood imho, because they also provide information about the author and the creation date of the site.

    See also
  • Options
    How about making the description metatag to read from the first "n words" of the first comment? This will let search engines show descriptions that are more relevant to what users are searching for.
  • Options
    @ WallPhone: Just wanted to let you know, that you helped me with this Meta Tags extension. Thanks!
  • Options
    Me too WallPhone,
    I had hacked a way to include Meta Tags but your method is much more elegant.

    Thanks too!
  • Options
    Glad I could be of service. Perhaps I should add this to my list of extensions to write... incorporating blueonyx's needs.
  • Options
    I made a request about that on vanilla forum: http://lussumo.com/vanilladev/discussion/162/request-new-proprety-to-the-context-class-for-meta-tag/#Item_1
  • Options
    any reason why this isnt in the addons download section?
  • Options
    Its not developed to the point that I would put it up there and call it done.

    Imagine every Vanilla page where there are two form input fields at the top only visible to administrators. Discussion pages meta description pre-filled with the discussion topic. Administrators (or any role with 'can edit meta tags') can simply type what they feel is the best meta description and meta keywords in the boxes, and it propogates to the page.

    That is what I would submit to the add-ons.
  • Options
    ahhhh got ya.
This discussion has been closed.