[pmwiki-users] USe PTVs instead of directives (was (:title:) of (:include:) included pages overrides page title)

Eemeli Aro eemeli at gmail.com
Wed Feb 25 11:30:51 CST 2009

I'd like to note my support of this as well, with some provisions.

Getting rid of the special directive markup for page title,
description and keywords is a good idea. It looks like those were
added during the 2.0 devel/beta cycle, while page text variables are a
much more recent addition.

The implementation differences mean that multiple definitions of a
variable get handled rather differently for title/description/keywords
wrt. page text variables. Page text variables are set per page, and
re-defining one overwrites the earlier definition. Definitions for
title/description/keywords always apply to the current page, even if
said definition is from an included page, and re-defining the
description or keywords doesn't overwrite the previous, but appends to

Another concern that ought to be addressed is page caching. Currently,
defining any of title/description/keywords for a page disables the
caching done if $EnableHTMLCache is set on, as these are seen to
change the page meta tags, which are external to what's cached by
HTMLCache (just the HTML corresponding to the page text). For most
cases, this is probably detrimental and could be avoided with
relatively small changes.

So, this is what I propose:

 1) Remove the special markup for the page title, description and keywords.
    The current/old markup can be added to $PageTextVarPatterns and
    $ROEPatterns to make the transition relatively painless.

 2) Let PrintMetaTags() (in stdmarkup.php) refer to the page attributes
    instead of page text variables when generating the meta tags.

 3) Add a call for PageTextVar() to SaveAttributes(); the page text
    variables are only loaded to $PCache by MarkuptoHTML() if there is a
    reference to a page text variable in the markup. If we're using the
    normal page text variable markup for these variables, they need to be
    explicitly loaded when saving the page to make sure they're saved as
    page attributes.

 4) Fix the display of page text variables in page edit preview.

And that's it, the rest is already handled by PmWiki core
functionality and certain benefits emerge:

  * When saving a page, UpdatePage() calls SaveAttributes(), which reads
    $SaveProperties and therefore saves the correct page text variables
    (by default, the title, description and keywords) as page attributes.
    Currently this isn't done as SaveAttributes doesn't (:include:) pages
    or look at the GroupHeader/Footer, which atm can set values for the
    variables in question.

  * The SetProperty function becomes useless unless called by some
    cookbook recipe.

  * A page with these variables set can be cached without problems, as
    they're stored as page attributes, which are always read by

Defining eg. a page title externally to the page in question is still
possible with this system, it just needs to be done explicitly on the
page in question; eg. (:title:{Some.OtherPage$:title}:). Similarly
appending to a variable can be done, but only explicitly; eg.
(:keywords:{Some.OtherPage$:keywords}, more, words:).

The fourth point mentioned above is a more general issue, and refers
to the current way that previewing a page where you've changed the
definition of a page text variable always displays the old, saved
value. This is somewhat confusing and happens with the current markup
for the page description and keywords as well; for the page title
there's a somewhat hacky fix that was introduced in 2.1.21


2009/2/22 Simon <nzskiwi at gmail.com>:
> I fully support changing title, description, and similar to PTVs in the new
> version of PM wiki.
> I think it is confusing having
> (:Title yadda:)
> and (:Title:yadda:)
> Also it resolves the issue of which include comes first - as none do (being
> PTVs), but they can be accessed in the normal PTV way from other pages.
> The issue of setting a page title in GroupHeader for GroupFooter is harder,
> but one could argue that this should not be done, title applies to a page,
> not a group.
> If the title is an expression calculated for each page perhaps we need a
> specific way of setting it for a page from another page, eg (:*title:yadda:)
>  (cf {*$:title} )
> Simon
> 2009/2/4 Patrick R. Michaud <pmichaud at pobox.com>
>> [snip]
>> I've also thought from time-to-time that we'd be much
>> better off if we switched to using page text variables
>> instead of specialized directives for these "attributes".
>> Pm
>> _______________________________________________
> _______________________________________________
> 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