Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Adding "create this page" link on "Page not found" pages

Jeff Chapin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 17, 2012

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?

1 answer

0 votes
twong_atlassian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 28, 2012

Hi Jeff:

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events