Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

I want to add extra META tag, only for discussion pages

ChanuxChanux Admin of Geek.lk ✭✭

I want to add extra META tag, in HEAD section, only for discussion pages

have you any idea about that ?

Answers

  • hgtonighthgtonight ∞ · New Moderator

    If you don't want to use one of the SEO plugins, write your own.

    <?php if (!defined('APPLICATION')) exit();
    $PluginInfo['SingleMetaTag'] = array( // You put whatever you want to call your plugin folder as the key
        'Name' => 'Single Meta Tag', // User friendly name, this is what will show up on the garden plugins page
        'Description' => 'This adds a single meta tag to the discussion controller head module.', // This is also shown on the garden plugins page. Will be used as the first line of the description if uploaded to the official addons repository at vanillaforums.org/addons
        'Version' => '0.1', // Anything can go here, but it is suggested that you use some type of naming convention; will appear on the garden vanilla plugins page
        'RequiredApplications' => array('Vanilla' => '2.0.18.8'), // Can require multiple applications (e.g. Vanilla and Conversations)
        'MobileFriendly' => TRUE, // Should this plugin be run on mobile devices?
        'Author' => 'Zachary Doll', // This will appear in the garden plugins page
        'AuthorEmail' => 'hgtonight@daklutz.com',
        'AuthorUrl' => 'http://www.daklutz.com',
        'License' => 'GPLv3' // Specify your license to prevent ambiguity
    );
    
    class SingleMetaTag extends Gdn_Plugin {
    
        public function DiscussionController_Render_Before($Sender) {
            $Sender->Head->AddTag('meta', array(
                'name' => 'description', // This sets the name attribute of the meta tag to description (e.g. <meta name="description" />)
                'content' => 'This is my content of the meta tag'
                ));
        }
    }
    

    You can find out more about writing plugins on the community wiki.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • peregrineperegrine MVP
    edited November 2013

    I hope he doesn't tell you I don't want a plugin, i want to know how to do it. like he did last time (and then left the question hanging without responding - re:the spam applicants. and quite a few questions he has asked before)

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • did this work for you @chanux.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.