How do I customize the search result page?

I've added custom headers and footers and just about everything else to our Confluence site, but I can't find where I would do this for the SERP (Search Engine Result Page). It picks up global styles just fine, but I want to add the header and footer at the very least. Any ideas? Thanks!

2 answers

Would it be sufficient to just do it in the Custom HTML configuration at http://YOURCONFLUENCE/admin/viewcustomhtml.action? You can insert custom HTML code at 'the end of the HEAD' or 'At end of the BODY'.

Turns out the easiest way to modify the SERP is to muck with the global layouts. Also turns out to be a little dangerous... :)

So Matthew - what did you learn in Detail ?

Well, to edit the layouts, I edited the Main Layout and Page Layout site layouts in the Administration's Layouts section. One big thing was that if you comment out too much stuff, and replace it with custom HTML/Velocity code, you might unintentionally hide important aspects of the rendered pages such as the login form on the login/logout page and the contents of the SERP.

One thing that I ran into multiple times is that no matter how careful I was with opening and closing DIV and #if/#else/#end blocks, there appear to be others that are added either higher up or lower down "the chain" of rendering pages. As a result, you have to be very careful when removing or replacing these sorts of enclosures otherwise you can "break" the engine and get runtime errors.

Because our site doesn't use sidebars, I was able to remove a large swath of the global layout (the entire section inside the "sidebar-container" div.

Also of note is that I removed the "assistive-skip-links" section, even though I'm not entirely sure what they do.

One word of caution. I made a change that prevented the login pages from rendering. Then I went to lunch. When I got back, of course, I could not edit the page again until I logged in again, which caused some problems (obviously). To fix this, I had to edit the DECORATOR table in the database and restore the value of the correct decorator's BODY field to a rolled-back version. The SPACEKEY in this table refers to the space, and when the value is "NULL", it refers to the global space (which I figured out by trial and error).

Anyway, these are just a couple of gotchas. Eventually got it working, but it would be so nice to have layout access to the SERPs and other pages, IMHO.


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

792 views 33 5
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