Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×I can't find any information online about customizing the Confluence search to exclude images and all other attachments. I know that users can set a filter on the advanced search page, but I'd like the default search to return only pages (no images, other attachments, blogs, etc.).
I'd appreciate any and all ideas.
Best,
Jesse
You can exclude attachments from being indexed. Here is the documentation for that.
https://confluence.atlassian.com/display/CONFKB/How+Do+I+Disable+Indexing+of+Attachments
Thanks, Davin. I've looked through that document before. It seems to be about excluding Word, PowerPoint, Excel, and PDF files, but I'm interested in excluding all images as well. Is that also possible by editing the atlassian-plugin.xml?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you want users to not ever be able to search for these, or just not by default using the top right search box? If you just want to make sure that the top right search bar will by default only show pages then you can add this Javascript to the global custom html. This will put in a hidden field in the form element of the top right search box that says to only return pages.
AJS.toInit(function(){ AJS.$('#quick-search').append('<input type="hidden" name="type" value="page">'); });
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is exactly what I was looking for. Thanks very much, Davin! It works perfectly for the global search.
I tried to apply this to the search box in the pagetree area (documentation theme) but didn't have any luck. Instead, I hid the default search box in the space stylesheet and configured the doc theme to include the {search-box} macro, which lets me filter by type.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried this too and it seemed to do nothing. Did you apply the custom html to header, body, or footer?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It should be in the after body section. Also, you need to wrap it in script tags. <script type="text/javascript"> AJS.toInit(function(){ ... }); </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
David, I found a solution for filtering page tree search results. A bit of a hassle, but it works.
In each space, we did the following:
1. We configured the Documentation theme (Browse > Space Admin > Themes Configure them), adding a custom search macro to the page tree area. We also used the html macro to tag the search box with an html id, so that we can target it in the space styesheet.
{html}<div id="customsearchbox">{html} {search-box:space=console|type=page} {html}</div>{html} |
2. We editing the space stylesheet (Browse > Space Admin > Stylesheet) to hide the default search box and apply our styling to the custom search box:
/**************************************** Space-specific search box Default search box is hidden; custom is included in the doc theme *****************************************/ #pagetreesearch { display: none; } #customsearchbox { margin: 10px 0 10px 20px; min-width: 230px; } #customsearchbox form.confluence-searchbox.adaptavist-searchbox { white-space: nowrap; margin: 1.5em 0 0 0; position: relative; } #customsearchbox input[type=text], #customsearchbox input[type=submit] { margin: 0 8px 8px 0; border: 1px solid #CCCCCC; color: #666666; max-width: 165px; padding: 4px 5px; height: 2.14285em; line-height: 1.4285; box-shadow: inset 0 1px 3px #CCC; width: 100%; border-radius: 3.01px; font-size: inherit; font-family: 'Open Sans', Arial, sans-serif; box-sizing: border-box; } #customsearchbox input[type=submit]{ background: #f2f2f2; background: -moz-linear-gradient(top,#fff 0,#f2f2f2 100%); background: -ms-linear-gradient(top,#fff 0,#f2f2f2 100%); background: -o-linear-gradient(top,#fff 0,#f2f2f2 100%); background: -webkit-linear-gradient(top,#fff 0,#f2f2f2 100%); background: linear-gradient(top,#fff 0,#f2f2f2 100%); text-decoration: none; text-shadow: 0 1px 0 white; vertical-align: baseline; min-width: 0; width: auto; box-shadow: none; } |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.