DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:description

This is an old revision of the document!


description plugin

Compatible with DokuWiki

2008-05-05

plugin Copies a page's "description abstract" meta-data to a meta header line that is visible in the page source.

Last updated on
2010-11-09
Provides
Action

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to combo, keywords, meta, metaheaders

Tagged with meta

Download description.zip (1 KB)

This DokuWiki plugin append an abstract of a page (meta['description']['abstract']) for meta headers. This functionality is applied to all pages by installing the plugin.

Example

The appended meta header of the demo page is like this.

...
<meta name="description" content="This DokuWiki plugin append an abstract of a page for a meta header. This functionality is applied to all pages by installing the plugin.   The appended meta headers of this page is like this.    ... &lt;meta name=&quot;description&quot; content=&quot;This DokuWiki plugin append an abstract of a page for a meta header. This functionality is applied to all pages by installing the plugin. ExampleA meta headers of this page is like this.&quot; /&gt; ..." />
...

Discussion

This looks like just the feature what I want. But how do I use it? I installed the plugin and I guess I was expecting an admin menu item or a Configuration section to allow me to enter the text I wanted. I can't see either of those. I can't work out how it get it going - Thanks. Chris 8Sep08

This plugin only copies 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 meta plugin, see description→abstract element. But changing it probably will change RSS feed output if you use abstract mode of RSS. — Martin Plicka 2008/09/08 09:46

Broken link for download was fixed. — iobataya 2010/11/09 14:18

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 :) — flam 2010/12/28 19:00

Another problem:

I'm using this plugin also with Keywords plugin. The abstract is actually not created from the beginning of the page but it takes all words marked with BOLD at my page www.riversedge.pl. Why? Any chances to fix it? — V-12 2011/08/18 10:54

Edit: The abstract ignores Styled text except Bold text. Any chances to have this plugin working like Keywords plugin where I can manually write description for single page? — V-12 2011/08/25 18:41

plugin/description.1314300577.txt.gz · Last modified: 2011-08-25 21:29 by flam

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki