====== Description Plugin ====== ---- plugin ---- description: Copies a page's abstract, a global description, or individual text to a meta header line that is visible in the page source. author : Ikuo Obataya, Matthias Schulte email : dokuwiki@lupo49.de type : action lastupdate : 2012-07-02 compatible : Lemming, Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Hrun depends : conflicts : similar : keywords, meta, metaheaders, combo tags : meta, seo securitywarning: This plugin does not respect ACL, see https://github.com/lupo49/plugin-description/issues/6 downloadurl: https://github.com/lupo49/plugin-description/tarball/master bugtracker : https://github.com/lupo49/plugin-description/issues sourcerepo : https://github.com/lupo49/plugin-description ---- ===== Security ===== This plugin does not respect ACL, it could leak sensitive data through the login page, see https://github.com/lupo49/plugin-description/issues/6 ===== Usage ===== There are three alternative methods to specify the meta header keywords: * Configuration option "keyword_source" * Value "abstract" * The meta headers are automatically filled with an abstract of the page of the DokuWiki metadata system * Value "global" * A global value (specified with the configuration option "global_description") is used on every page * Value "syntax" * The keywords can be individually specified for each page == Syntax == (If configuration is set to "syntax") {{description>Place the page description here}} ===== Example ===== ... ... ===== Discussion ===== > This plugin only copies an abstract created by DokuWiki (e.g. for RSS feed) to meta headers. The abstract is created from the beginning of the page. To alter it, you can use [[plugin:meta]] plugin, see description->abstract element. But changing it probably will change RSS feed output if you use abstract mode of RSS. --- //[[mail@mplicka.cz|Martin Plicka]] 2008/09/08 09:46// \\ I modified the description function to make it more search engine friendly (max. 150 chars / max 30 words). New: Checks if DOKU_MEDIADETAIL is set so no duplicate description tags will be generated for media detail view. function description(&$event, $param) { if(empty($event->data)||empty($event->data['meta'])) return; global $ID; $d = p_get_metadata($ID,'description'); if(empty($d)) return; $a = str_replace("\n"," ",$d['abstract']); if(empty($a)) return; // Begin SEO Changes // Set the max words and the max lenght for description Tag $words = 30; //Max 30 words $lenght = 150; //Max 150 characters $array = explode(' ',$a); $a = ""; $i = 0; foreach($array as $value){ if($value != ""){ if( $i <= $words){ $temp .= $value." "; if(strlen($temp) <= $lenght){ $a .= $value." "; }else{ break; } }else{ break; } } $i++; } // END SEO Changes $m = array("name"=>"description","content"=>$a); if(!defined('DOKU_MEDIADETAIL')){ $event->data['meta'][] = $m; } } If you like it, you can use it :) --- [[user>flam]] //2010/12/28 19:00// >I'm using this plugin also with the Keywords plugin. The abstract is actually not created from the beginning of the page but it takes all words marked with BOLD on my page www.riversedge.pl. Why? Any chances to fix it? --- [[user>V-12]] //2011/08/18 10:54// >> Edit: The abstract ignores styled text except bold text. Any chances to have this plugin working like the Keywords plugin where I can manually write description for a single page? --- [[user>V-12]] //2011/08/25 18:41// >>>The syntax configuration option allows it. --- [[user>lupo49|M. S.]] //2012/07/01 19:35// seems pagelist cannot pick up the output of this plugin in Weatherwax[[user>harald]] > Would be practical if syntax could override an abstract or global default description. [[user>molefunk]]