[pmwiki-users] Conditional markup in head of template problem
Petko Yotov
5ko at 5ko.fr
Fri Jul 20 03:25:55 CDT 2012
Lars Eighner writes:
> My motivation here is I want to keep pages in the Living group and the
> Whisper group (which is like Talk but password protected) out of search
> engines.
There is one more thing, you can actually block the access of known robots
to the content of the privéate sections, instead of letting them read the
pages and hoping they will obey the noindex tag.
In local/Living.php and local/Whisper.php:
<?php
$MetaRobots = 'noindex,nofollow'; # for unknown robots
$RobotActions['browse'] = 0;
> But the general problem here is how to have conditional markup in
> the head of a template,
Inserting stuff in the <head> section of a wiki page is done differently.
You have to add the stuff as an element of the $HTMLHeaderFmt array in a way
similar to that in Cookbook:ControllingWebRobots.
> which might be, for example, used to vary styles sheets.
You probably don't need this for stylesheets. PmWiki looks into the
directory pmwiki/pub/css and inserts in the page the files Group.css and
Group.Page.css if it finds them (Group.Page is the currently viewed page).
So if your styles are based on the page group or name, just create those
files in pub/css.
Otherwise, to inject css styles programatically/conditionally, you can add
the styles as an element of the $HTMLStylesFmt array.
global $HTMLStylesFmt; # if inside a function
$HTMLStylesFmt['myownstyles'] = "h2 {color: blue;}";
Petko
More information about the pmwiki-users
mailing list