[pmwiki-users] Insert meta tag in <head>

Petko Yotov 5ko at 5ko.fr
Thu Feb 11 03:55:25 CST 2016


Something like this in config.php should do:

   $HTMLHeaderFmt['facebook'] = '
     <meta property="og:title" content="$Title" />
     <meta property="og:type" content="article" />
     <meta property="og:url" content="$PageUrl" />
     <meta property="og:description" content="$Description" />
   ';

If you call this from within a function, before it declare:

   global $HTMLHeaderFmt;

$Title is the title or the name of your page, to control it you can 
insert in the page:

    (:title Your page:)

$PageUrl is the regular address of the page, without any parameters 
(search, subpage, anchor section...).

$Description can be controlled from the page with this:

   (:description Here is a good description. 2 phrases should do.:)

One thing it doesn't have is a picture tag:

   <meta property="og:image" 
content="http://your/site/uploads/$Group/$Name.jpg" />

then you upload a file $Name.jpg where $Name is the name of the page, 
for example HomePage.jpg or WikiSandbox.jpg. It is a bad idea to have 
such a tag and to not have the picture it references. If you don't use 
this tag, Facebook should automatically select the first large picture 
in the main content area.

Petko

---
Change log     :  http://www.pmwiki.org/wiki/PmWiki/ChangeLog
Release notes  :  http://www.pmwiki.org/wiki/PmWiki/ReleaseNotes
If you upgrade :  http://www.pmwiki.org/wiki/PmWiki/Upgrades


On 2016-02-10 19:34, Thomas Lundgren wrote:
> I´ve made a cookbook from where I will share the page to Facebook. To
> be more sure that Facebook grabs the page correct Facebook "require"
> some meta tags in the <head>-part of the html-page.
> 
> How do I - from a cookbook insert meta tags into the <head>-part? Do I
> in some way have to alter the skin? How?
> 
> Many thanks in advance!
> 
> Regards. / Thomas.
> 
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users



More information about the pmwiki-users mailing list