Auto-format a Confluence link in a template

Hi there,

I'm having a devil of a time getting a specific piece of functionality to work in the Confluence templating system. I wonder if folks can suggest some ways this can be done?

Essentially what I want to do is to create a template that has a bunch of parametrized fields that are filled in when the page is created, and from that construct a page that has all sorts of nice URLs and macros pointing to useful resources. This is to create a project dashboard for a particular release that is managed in JIRA and also Bugzilla.

So let's say I have a JIRA project called 'SDK' and I'm working on release '1.0' of the SDK; that's reflected into Bugzilla with a component name of 'My SDK'. What I'm trying to do is define a template with form-fill fields so the user can type in the project name, version, and bugzilla ID, and the resulting page will have the right title, text, and links. I've tried to use the standard @VAR@ syntax, but that does not appear to work in many cases:

Template markup like this:

[http://jira:8080/browse/@JIRAPROJECT@]

appears to completely ignore the defined variable. Also

[@JIRAPROJECT@ @VERSION@ Requirements] - I want that to create a link to a new Confluence page that holds requirements for this project.

I'm also trying to do something like this in the template markup:

{gadget:url=http://jira:8080/rest/gadgets/1.0/g/com.pyxis.greenhopper.jira:greenhopper-gadget-project-dashboard/gadgets/greenhopper-project-dashboard.xml|width=600}
selectedProjectId=filter-@VersionID@&showLabels=false&showLegend=true&selectedBoardId=&contextName=&chartType=&startDate=&endDate=&fieldId=&forMaster=false&isConfigured=true&refresh=false
{gadget}

Leaving aside the problem that this forces a user to go look up the internal version ID in JIRA, this doesn't work either (the variable is ignored).

So I think the root of this problem is that @VAR@ variables in the template markup should be recognized anywhere, even if not preceded by a space or embedded in a link.

Note that one thing I tried to do was just add a bunch of spaces in the URLs and remove the starting brackets, figuring the page editor could just simply edit out the spaces, pre-pend a square bracket, and Bob's your uncle, they'd have a proper link. But of course the RTF editor makes that impossible because you can't just edit the link target using the text on the page.

That's definitely one feature request I'd have, short of restoring full wiki text support - allow people to edit specific types of content, like link aliases and targets, without forcing them to pop up a separate editor.

1 answer

0 vote

It's acting funky for me too. This is a known issue in Confluence 4 - it's buggy. You can weigh in with use cases here:

https://jira.atlassian.com/browse/CONF-11744

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

357 views 20 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you