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.

matt

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...

2,768 views 26 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