[pmwiki-devel] PmWiki Skin and Default name

Petko Yotov 5ko at 5ko.fr
Sat Aug 19 22:39:52 PDT 2023


Short answer: You can try setting this to config.php:

   $PagePathFmt = array('{$Group}.$1','$1.{$DefaultName}','$1.$1');

This will affect the "Name" link in the page header, as well as wiki 
links like [[Name/]], [[Name.]], [[Name]] from within the Name group, 
and [[Name]] from another group.

Long answer:

There is ambiguity when you have pages Name.Name, Name.HomePage, and/or 
Main.Name. When a link [[Name]] is encountered indeed PmWiki may use a 
process different from the one in the author's mind. Same for the "Name" 
link in the page header. Same for (:pagelist list=grouphomes:) and the 
recently added page variables {$GroupHomePage} and similar.

To calculate the full page name in the case only "Name" (no group) is 
supplied, the array $PagePathFmt is used, and the first page that exists 
from that array is returned.

This is the default:
   $PagePathFmt = array('{$Group}.$1','$1.$1','$1.{$DefaultName}');

When the string "Name" is derived from the URL, such as when the browser 
follows a group link from a page header, then {$Group} is 
{$DefaultGroup} (Main) and the URL works like when it was a link 
[[Name]] in the Main group.

When you have a link [[Name]] in any group, it will process it according 
to $PagePathFmt. So it will first try CurrentGroup.Name, then Name.Name, 
then Name.HomePage, and whatever page first exists it will be returned.

For links [[Name/]] or [[Name.]], it knows that "Name" is the group 
name, but then again if both Name.Name and Name.HomePage exist, it will 
use the order of $PagePathFmt.

Note that a link [[Name]] in a page of the Name group would point to 
Name.Name if it exists (from '{$Group}.$1'), and the same link in 
another group may point to Name.HomePage.

Also a link [[Name]] in a group different from Name/, and a link 
[[Name]] "included" in another group from the Name/ group (by 
(:include:) or a page text variable, or a sidebar) may link to different 
pages.

We could add a separate array to process the string from the URL (in 
ResolvePageName) different from $PagePathFmt that processes links in 
pages, but I'm afraid then you may have unexpected results with 
[[Name/]] and [[Name.]] links.

Alternatively, use Name.Name as the group homepages, and remove the 
pages Name.HomePage and Main.Name.

Petko


On 20/08/2023 04:09, Simon wrote:
> In the PmWiki responsive skin there are the lines
> 
> <!--PageTitleFmt-->
>           <div id='wikititle'>
>             <div class='pagegroup'><a
> href='{$ScriptUrl}/{$Group}'>{$Group}</a> /</div>
>             <h1 class='pagetitle'>{$Title}</h1>
>           </div>
> 
> In my config.php I set
>       $DefaultName = 'HomePage';
> 
> In my wiki I have two pages
> 
>     MyGroup.HomePage (the landing page for the group)
> and
>     MyGroup.MyGroup
> 
> Event though I have configured the default name to "HomePage" PmWiki
> continues to send page references in the form (specifically in the
> page title as shown above)
>     "MyGroup/ "
> to "MyGroup/MyGroup" if the Page "MyGroup.MyGroup" exists, this
> doesn't seem right
> 



More information about the pmwiki-devel mailing list