We have an existing internal utility that automatically creates links to additional information about all of our servers, of the form http://confluence.domain.edu:8090/display/SYS/sboxpup.domain.edu . If this page pre-exists, everything is fine. If this page does not exist, we are given a default 'Page not found' page, and not given an option to create it. We would like to be able to add content to this URLs on-demand. Is this possible?
Was an interesting problem.
You can alter the 404.vm velocity file that controls the 404 page in confluence. You can create a page on confluence by simply hitting http://yourinstance/pages/createpage.action?spaceKey=SOMEKEY&title=SOMETITLE
As such, I was thinking of just adding a link to 404.vm which gets shown on a page not found that reads the missing title and constructs a url as mentioned above.
Easy enough right? Well, this is where I ran into a wall. One of the features of Confluence is that we will search for analogues of your page title before returning 404, so that if you wanted a page like 'hoem' it might find the 'home' page in your space. You can usually figure out what page you're on or what url got you to a particular location using some of the objects in https://developer.atlassian.com/display/CONFDEV/Confluence%20Objects%20Accessible%20From%20Velocity. Hoewver, because we direct you first to the PageNotFoundAction then to the FourOhFourAction upon failure to find mispellings, we lose the original title/request url.
Lame. You could hard code the right space.... but then you'd still have to type in a title (if you omit the &title part of the url, it'll just be "new page")
Of course, you could muck with PageNotFoundAction.java, and change the behavior of the whole thing... but thats a rather large change.
Meh... not a great answer for it, but this is where I drew the line and gave up.
It's officially Tuesday, which means it's officially time for another tip to help you better navigate this space we call the Atlassian Community. 😄 I got a great question from community member, Sa...
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!
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