[pmwiki-users] Swapping $WikiTitle, $Group, $Title

Petko Yotov 5ko at 5ko.fr
Tue May 12 07:42:56 PDT 2020


I see that you want Name / Group | WikiTitle, use this code instead:

   $HTMLFooterFmt['rewrite-title'] = '<script>
     document.title = 
document.title.replace(/^([^|]*)\|([^\\/]+)\/([^|]*)/, "$3 / $2 | $1");
     </script>';

here $3 will be the name, $2 the group and $1 the WikiTitle -- mix and 
match. To have a single backslash, double it.

Petko

On 12/05/2020 16:35, Petko Yotov wrote:
> I would not recommend editing a core skin, you should copy the skin
> directory to a new name say "pmwiki/pub/skins/myskin", make your
> changes to the new skin and set the $Skin variable accordingly.
> 
> Alternatively, there is a way to inject a small JavaScript that can
> rewrite the document title:
> 
>   $HTMLFooterFmt['rewrite-title'] = '<script>
>     document.title = document.title.replace(/^([^|]*)\|([^|]*)/, "$2 | 
> $1");
>     </script>';
> 
> This will only work when JavaScript is enabled in the browser;
> thankfully most of today's search engine bots do have JavaScript
> enabled.
> 
> This should also work when you are in ?action=edit and the title looks 
> like
> 
>   WikiTitle | Main / WikiSandbox | Edit
> 
> will become
>   Main / WikiSandbox | WikiTitle | Edit
> 
> Petko
> 
> On 11/05/2020 20:09, Robert Riebisch wrote:
>> Besides copying and editing the default skin, is there another way to
>> swap $WikiTitle, $Group, $Title? Perhaps via config.php.
>> 
>> I want "fooWiki | Main / HomePage" to become "Main / HomePage | 
>> fooWiki"
>> or "HomePage \ Main | fooWiki".
> 
> 
> _______________________________________________
> 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