plugin:htmlmetatags
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:htmlmetatags [2016-07-06 10:48] – [Improve completeness of accepted metatags] 88.160.29.72 | plugin:htmlmetatags [2023-10-31 00:08] (current) – Klap-in | ||
---|---|---|---|
Line 2: | Line 2: | ||
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
author | author | ||
email : info@soft2c.de | email : info@soft2c.de | ||
type : Action, Syntax | type : Action, Syntax | ||
- | lastupdate : 2015-05-19 | + | lastupdate : 2023-06-12 |
- | compatible : 2012-10-13 "Adora Belle",2013-05-10a " | + | compatible : Detritus, Elenor of Tsort, Frusterick Manners, Greebo, Hogfather, Igor, Jack Jackrum |
- | tags : html meta search seo info | + | depends |
- | + | conflicts | |
- | downloadurl: http://www.soft2c.de/pub/ | + | similar |
+ | tags : html meta search seo info open graph semantic | ||
+ | |||
+ | bugtracker | ||
+ | sourcerepo : https:// | ||
+ | downloadurl: | ||
donationurl: | donationurl: | ||
---- | ---- | ||
Line 16: | Line 21: | ||
===== Description ===== | ===== Description ===== | ||
- | This plugin enriches the html page with all meta tags what you wont, e.g. keywords, description and any others. | + | This plugin enriches the html page with all meta tags what you want, e.g. keywords, description and any others. |
Some meta information are very usefull for web crawlers for indexing and categorizing the page. | Some meta information are very usefull for web crawlers for indexing and categorizing the page. | ||
+ | |||
+ | Extends with V2.0: | ||
+ | This version allow you to add : | ||
+ | * open graph metatags like // | ||
+ | * link to media file. tags must start with //media-// | ||
+ | * // | ||
+ | * multiple calls to htmlmetatags all values will be added | ||
+ | |||
+ | **Note:** The Initial version of this plugIn is not compatible to the new V2.xy. The difference of attribute to value splitter is changed from ':' | ||
+ | |||
+ | < | ||
+ | {{htmlmetatags> | ||
+ | </ | ||
+ | |||
+ | **Note:** Linebreaks can add inside the < | ||
+ | < | ||
+ | {{htmlmetatags> | ||
+ | metatag-og: | ||
+ | }} | ||
+ | </ | ||
===== Syntax ===== | ===== Syntax ===== | ||
- | With the string '' | + | With the string '' |
Also, the plugin is on page level. | Also, the plugin is on page level. | ||
Line 28: | Line 53: | ||
< | < | ||
- | {{htmlmetatags> | + | {{htmlmetatags> |
</ | </ | ||
- | The meta tag: //mytag// is any word. This word is the name of the new meta tag, e.g. keyword. Followed on this name is to write '' | + | The meta tag: //mytag// is any word. This word is the name of the new meta tag, e.g. keyword. Followed on this name is to write '' |
You can write more than once meta tag on the page separate by space. | You can write more than once meta tag on the page separate by space. | ||
< | < | ||
- | {{htmlmetatags> | + | {{htmlmetatags> |
+ | metatag-keywords=(apfel, | ||
+ | metatag-description=(Allgemeiner Obstbauer) | ||
+ | metatag-media-og: | ||
+ | metatag-og: | ||
+ | metatag-og: | ||
+ | }} | ||
</ | </ | ||
Line 42: | Line 74: | ||
<code html> | <code html> | ||
- | <meta name=" | + | <meta name=" |
<meta name=" | <meta name=" | ||
- | <meta name=" | + | <meta name=" |
+ | <meta property=" | ||
+ | <meta property=" | ||
+ | <meta property=" | ||
</ | </ | ||
===== Installation ===== | ===== Installation ===== | ||
- | Download | + | Search and install |
- | ===== Change Log ===== | + | Download the plugin at [[https:// |
- | * **2015-05-27** Initial release | + | ===== Further Informtions ===== |
- | * **2016-04-22** Change | + | This section explains some usefully tips for using the plugin. Check your generated html code for the right meta tag and optimize it with this plugin. Crawlers (like google) collect their data by reading the the meta tag and then by the content. Of curse every crawler uses own algorithm for indexing the web pages. |
- | ===== FAQ ===== | + | * [[https:// |
+ | * [[http:// | ||
+ | * [[http:// | ||
- | ===== Discussion ===== | ||
- | The date in plugin.info.txt is not correct! Maybe a typo, but dw says " | + | ===== Change Log ===== |
- | ==== Improve completeness of accepted metatags ==== | + | {{rss> |
- | This code allow you to add : | + | |
- | | + | * **2017-02-08** V2.1 when no metadata is available then set/add this on page (with the given keys via this plugin) |
- | * link to media file. tags must start with //media-// | + | * **2016-07-12** V2.0 add handling for open graph metatags |
- | * //media-og:image=(:wiki:image.jpg)// | + | * **2016-04-22** Change the date for "last Update" |
- | * multiple calls to htmlmetatags all values will be added | + | * **2015-05-27** Initial release |
- | Syntax is improved to (note the difference of attribute to value splitter from : to =) | + | ===== FAQ ===== |
- | {{htmlmetatags> | + | |
- | Note: you can add linebreaks inside the < | + | ===== Discussion ===== |
- | {{htmlmetatags> | + | |
- | metatag-og: | + | |
- | }} | + | |
- | To implement this, replace these two functions | + | ==== Feature Request: Define OpenGraph image directly |
- | <code php> | + | |
- | /** | + | |
- | * Based on the code by Heiko Heinz | + | |
- | * Modifications by Eric Maeker, 2016, BSD licence | + | |
- | */ | + | |
- | /** | + | **Proposal:** In the spirit |
- | * Handle matches of the htmlmetatags syntax | + | |
- | * | + | |
- | * @param string $match The match of the syntax | + | |
- | * @param int $state The state of the handler | + | |
- | * @param int $pos The position in the document | + | |
- | * @param Doku_Handler | + | |
- | * @return array Data for the renderer | + | |
- | */ | + | |
- | public function handle($match, | + | |
- | // Remove all linefeeds before parsing attributes | + | |
- | $match = str_replace(PHP_EOL, | + | |
- | // Explode match into attributes array using ' | + | |
- | return explode(" | + | |
- | } | + | |
- | /** | + | **In general:** Thanks |
- | * Render xhtml output or metadata | + | |
- | * | + | --- [[user>porg|porg]] //2021-06-21 20:09// |
- | * usage: {{htmlmetatags> | + | |
- | * @param string | + | |
- | * @param Doku_Renderer | + | |
- | * @param array $data The data from the handler() function | + | |
- | * @return bool If rendering was successful. | + | |
- | */ | + | |
- | public function render($mode, | + | |
- | + | ||
- | global $ID; | + | |
- | + | ||
- | switch ($mode) { | + | |
- | case ' | + | |
- | /* | + | |
- | * e.g. | + | |
- | * data[0]=" | + | |
- | * data[1]=" | + | |
- | */ | + | |
- | | + | |
- | $mt = explode(" | + | |
- | $size = sizeof($mt); | + | |
- | + | ||
- | // If attributes | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | } | + | |
- | // Send result to renderer | + | |
- | if (!empty($content)) { | + | |
- | if ($name == " | + | |
- | if (!empty($renderer-> | + | |
- | $renderer-> | + | |
- | else | + | |
- | $renderer->meta[" | + | |
- | } | + | |
- | else | + | |
- | $renderer->meta[" | + | |
- | } | + | |
- | } | + | |
- | } | + | |
- | return true; | + | |
- | } | + | |
- | + | ||
- | return false; | + | |
- | } | + | |
- | </code> | + | |
+ | ==== Thanks by Eivind | ||
+ | Thanks for a really helpful plugin! I have one issue: Open Graph allows for several images to be specified, but this plugin smacks them together in the same meta content. |
plugin/htmlmetatags.1467794931.txt.gz · Last modified: 2016-07-06 10:48 by 88.160.29.72