Software-Entwicklung und Atlassian-Experte


Confluence Plugins

Voodoo Plugin

The voodoo plugin allows you to replace keywords on a Confluence page with values derived from URLs, labels, page titles, user details and space information.

Table of Content


License: BSD

Atlassian Plugin Exchange
Issues
Download History


Macros


{voodoo}, {voodoo2}, {voodoo3}

All occurrences of a keyword in the macro body are dynamically replaced by a value when the page is rendered. There are several different types of keywords:
  • Built-in keywords
  • Keywords defined in the macro parameters
  • Keywords derived from URL parameters
  • Keywords defined in Confluence labels
 

Parameters
ParameterMandatoryDefaultDescription
separatorno.Delimiter character or string to split the page title into different parts, see PAGETITLE1, PAGETITLE2 keywords.
paramsnononeUser defined macro parameters and values.
ignoreUPnofalseURL parameters are ignored.
norendernofalseMacro body is not rendered.


Built-in Keywords

The {voodoo} macro comes with a set of built-in keywords.
Keywords are replaced with value when the page is rendered.

 
Page  User
PAGETITLE - The current page title
PAGETITLE0 - First part of the page title
PAGETITLE1 - Second part of the page title
PAGETITLEn - nth part of the page title
4PAGETITLE6 - Truncate 4 characters from the left, 6 characters from the right
xPAGETITLEy - Truncate x characters from the left, y characters from the right
PAGEURL - The URL of the current page
BASEURL - The base URL of the current page
DOMAINNAME - The domain name part of the current URL
PAGEID - The Confluence page-ID of the page
PARENTPAGETITLE - The page title of the parent page
PARENTPAGEID - The Confluence page-ID of the parent page
GRANDPARENTPAGETITLE - The page title of the grand parent page
GRANDPARENTPAGEID - The Confluence page-ID of the grand parent page
PAGEISROOTLEVEL - Checks whether the page is at the root level of a space. Returnstrue or false (as a string)
ROOTPAGETITLE - The page title of the page at the root level of the current page
ROOTPAGEID - The Confluence page-ID of the page at the root level of current page
 USERNAME - Username (login) of the current user
USERFULLNAME - Full name of the current user
USEREMAIL - Email address of the current user
USERINFO - The info about me of the current user
NONATLASSIANGROUPS - All groups the current user belongs to, which do notcontain confluence or jira in the group name
FIRSTNONATLASSIANGROUP - First group the current user belongs to, which do notcontain confluence or jira in the group name


Space
SPACENAME - The name of the current space

SPACEKEY - The key of current the space
SPACEHOME - The page title of the home page of the space
SPACEHOMEID - The Confluence page-ID of the home page of the space



Miscellaneous

BACKSLASH - BACKSLASH is replace by a real "\" character (for further escaping)

 




Examples

  • The page title (Voodoo Plugin) is split, using the space character " " as a delimiter.

    {voodoo:separator=space}Take a look at part one *PAGETITLE0* and two *PAGETITLE1* of this page's title.{voodoo}

    Result: Take a look at part one Voodoo and two Plugin of this page's title.

 
  • The keyword USERFULLNAME is replaced with the full user name of the logged-in user. When no user is logged-in, the wordanonymous is displayed instead. The keyword PAGETITLE is replaced with the page title of the current page.

    {voodoo}User *USERFULLNAME* is viewing page *PAGETITLE*.{voodoo}

    Result: User John Miller is viewing page Voodoo Plugin


Keywords defined in the macro parameters

With the macro parameter params a comma separated list of keywords with values, which will be replaced in the body of the {voodoo} macro, can be defined.


Format: params="myParam1=value1,myParam2=value2, ..."


  • The word shape is replaced with circle from the macro paramenters. The word colour is replaced with red from the macro paramenters.

    {voodoo:params="colour=red,shape=circle"}The shape is colour.{voodoo}

    Result: The circle is red.


Keywords derived from URL parameters

Keywords with values can be made available trough URL-parameters. When the page is loaded any matching keyword in the body of the {voodoo} macro will be replaced with the respective value.

 
  • The link loads this page with the parameter dogs=cats added to the URL. The word dogs is replaced with the word cats from the URL parameter.

    {voodoo}
    Click this [link|PAGEURL&dogs=cats] to reload the page with an additional URL-parameter:
    My favourite animals are dogs.
    {voodoo}

    Result: My favourite animals are dogs.
     
 
Keywords defined in Confluence labels

Confluence labels can also be used as keyword-value-pairs. The label has to be of the format keyword=value.


  • The word baverage is replaced with wine from the label baverage=wine.
    A page has the following label: baverage=wine

    {voodoo}I like to drink a glass of baverage with a nice meal.{voodoo}

    Result: I like to drink a glass of wine with a nice meal.


Escaping


  • Use a backslash in front of any {voodoo} keyword and the keyword will not be replaced.

    {voodoo}This remains \PAGETITLE forever!{voodoo}

    Result: This remains PAGETITLE forever!


Keyword Replacement Order
  1. URL parameters
  2. Macro parameters (format: {voodoo:params="myParam1=myValue1,myParam2=myValue2,..."})
  3. Page title keywords (PAGETITLE, PAGETITLE1)
  4. Label keywords (e.g. label myParam=myValue)
  5. Page and Space keywords (e.g. PAGEID, SPACEID)
  6. User keywords (e.g. USERNAME, USERFULLNAME)
  7. BACKSLASH keyword (for further escaping)



FAQ
  • What are the macros {voodoo2} and {voodoo3} for?
    Confluence does not allow nested tags. If you need a {voodoo} macro inside another one, simply use {voodoo2} resp. {voodoo3}. They support the same keywords.



Comments