Can I exclude an article from search results?

Have more questions? Submit a request

16 Comments

  • Alison Ford

    I'm trying to add an article in draft mode, but I cannot see this option.  In edit mode there is no draft/published in the top right as indicated in the screen shot above.

     

    How do I control draft/published?

    0
  • Jessie Schutz

    Hi Alison!

    As long as you're in edit mode, that option should definitely show up for you. Can you post a screenshot of what you're looking at?

    0
  • Dave Voll

    I see there is mention of a jQuery code to hide a document from search results, would someone be able to give more info on how to accomplish this? I have an article that is hidden but published and viewable by anyone and hiding it from the search is my last thing to figure out so that it's only available to those with the link.

    0
  • Chris Wilson

    Hi Dave!

    I too am trying to create an article that is published and only accessible if you have the link for it, and is not searchable.  Curious how you accomplished the first part of not making it appear in any categories/sections, did you use a div tag or something?  Thanks in advance for your help!

    0
  • Jessie Schutz

    Hey, Dave and Chris!

    I did some poking around to see if anyone had actually posted code for this, and I didn't find anything for this specifically.

    However, I did find a tip from one of our Moderators, Andrea, with code to hide an article's author from search results

    My thought is that this code might be able to serve as a jumping off point, with some strategic changes made to hide the article completely.

    Keep us posted on how you get on! If you get stuck, let us know and I'll try to find a Moderator who can help you troubleshoot - we've got a couple folks who are good at this kind of thing. And if you do get it figured out on your own, it would make a great contribution for our Tips & Tricks section. :)

    0
  • Ian Maison

    Hi, this does not really work for us as we don’t want to enforce our users to have to sign in, our restrict them to being part of an Organisation. We simply want to hide the articles from Category/Section/Article view, which we’ve done with curlybars, and then simply not have the hidden articles return in the Help Centre search results.

    Is there no way to do this?

    0
  • Jessie Schutz

    Hey Ian!

    I can't speak to how it would work to restrict search results with JS, but I imagine you could probably figure out a way to do it.

    That said, it would be much easier to just restrict the individual sections you don't want your logged-out users to see. You can restrict them by tag or org, which will automatically hide them from logged-out users. No need to force anyone to log in or anything.

    0
  • Cale Shapera

    Howdy,

    I have some code which works (albeit haggardly) for this. If you want to hide an article called "Secret Article", plug in the following code:

    if($('li.search-result a:contains("Secret Article")').length > 0)
      {
        $('li.search-result a:contains("Secret Article")').hide();
        $('li.search-result a:contains("Secret Article")').next().hide();
        $('li.search-result a:contains("Secret Article")').next().next().hide();
      }

    I had to run the .hide() function three times to hide the title, author, and details, respectively.

    This is useful if you have an article that you want to link to a certain subsection of your readers, but don't want people surfacing it in the Zendesk search.

    Hope this is of help to someone!

    2
  • Kalle Windefalk

    Cale, would this work by using a label called "secret article"?

    1
  • Cale Shapera

    Hi Kalle,

    No, this code wouldn't work by adding a label.

    The code works by detecting the title of the article. Whatever the title of the article you want to hide, change "Secret Article" in the code to the name of that article.

    Cheers,

    Cale

    0
  • Kalle Windefalk

    Ah. Got it! Thanks a lot Cale

    1
  • Drew Kite

    Hello Cale, 

    I am not sure if you are able to help, I am looking for a way to hide a whole category from the help centre search. I am not sure if you are anyone else knows how this can be done? 

    Many thanks,

    Drew

    1
  • Cale Shapera

    Hi Drew,

    If your search results page includes the category, this should be possible.

    For example, on my search page, this is the category:

    If I check out the page in Chrome developer tools:

    We can see that the category name is displayed inside the <div> with a class "search-result-meta". So we can use jQuery selectors to find all the category links which include a specific term (the name of the category).

    In my example, if I wanted to hide the "Billing" category, my code would look something like this:

    if($('div.search-result-meta a:contains("Billing)').length > 0)
      { 
        $('div.search-result-meta').parent().hide();
      }

    I doubt the above code would actually work, but the idea would be to find every div that contains a link with your category name, and then, if the category name is present, hide the parent element (the <li> item that is displayed in the search results). With some fiddling, you can probably get it done.

    Hope this gets you on the right track!

    Cheers,
    Cale

    0
  • Drew Kite

    Hello Cale, 

    Thank you for the quick reply. Unfortunately I believe you are correct that this will not work, the category is not displayed but the articles within it.

    I was hoping there may be a way to blanket remove all items from search that are associated to a category? 

    Many thanks for your reply
    Drew

    0
  • Cale Shapera

    Hi Drew,

    I wish I had time to dig in to fixing this—I get a sick pleasure from solving these little problems—however, I'm quite busy right now. Perhaps try posting some code snippets along with your technical challenge to stackoverflow.

    If you can't wrangle through the jQuery, you could consider making the section containing the articles visible only to signed-in users. That would hide them from the search both in Google and on your site (if a user isn't logged in).

    That's the only other option I can think of offhand—good luck!

    Cheers,
    Cale

    0
  • Jamie Canada

    Hi all,

    I'm not sure that everyone understood the intent of the original poster (OP). The idea is to have a public Zendesk article; however, some (or all) of the contents shouldn't be searchable via Zendesk's search feature.  The good people at Zendesk have been clear that there is no feature to disallow the search of an article, and they've even offered a few workarounds.

    I too use my own workaround for this situation and I think it falls more in line with what the OP had in mind. I'd like to share my solution with you. I use it for our XPunch employee time punch clock help desk, and you can see an example of just such a Zendesk article at https://xpunch.zendesk.com/hc/en-us/articles/360027671032-Product-Updates-and-Fixes

     

    So, here's the thing: this particular article is a product update page. Every time we introduce a product feature, update, or fix,we want to be able to let our users know about it.  The problem is that many words we use in this particular article would appear in a search when users are genuinely looking for product help—we don't want to confuse them by displaying a link to this list of product updates. For example, we might advise everyone in our Product Updates article that we've just added "timesheets" as a new feature to the employee time recorder, but we don't want the search keyword "timesheets" to point to this article in the search results—we only want articles that explain how to use timesheets correctly to workers that use XPunch.

    So, the fix was easy: create a cloud document (I used Google Docs, but you can use anything that can be embedded on Zendesk), and embed the document into your Zendesk article. Zendesk won't be able to add the contents of your document to its search engine.

    In the case of Google Docs, the embed code will look something like this:

    <iframe src="https://docs.google.com/document/d/e/2PACX-1vRTXW-buJZ-VOBzBA07X9ReE9dla9Aq3_DKnHMKEXLxcoqTBedOMdnXVqFOsnmgJm7H2NbTfKcvMPpY/pub?embedded=true" width="100%" height="480"></iframe>

    To summarize, yes, it's still a workaround to getting text to not appear in Zendesk's search engine, but it's a quick and easy fix that allows articles to be public, yet not searchable.

    0

Please sign in to leave a comment.

Powered by Zendesk