Allow editors to exclude navigation items from search indices
authorErik Bernhardson <ebernhardson@wikimedia.org>
Tue, 18 Apr 2017 21:03:23 +0000 (14:03 -0700)
committerErik Bernhardson <ebernhardson@wikimedia.org>
Tue, 18 Apr 2017 21:12:47 +0000 (14:12 -0700)
When you perform a particular search, the results can be polluted by
navigation elements that are not supposed to be displayed. This gives
editors the ability to mark sections of the document that should not
be indexed.

Bug: T162905
Change-Id: Iab2b83c3778cd5f7f44736c0da569fd938ae2968

includes/content/WikiTextStructure.php

index 9f79aa8..afa03b8 100644 (file)
@@ -37,6 +37,9 @@ class WikiTextStructure {
                'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
                // Collapsed fields are hidden by default so we don't want them showing up.
                '.autocollapse',
+               // Content explicitly decided to be not searchable by editors such
+               // as custom navigation templates.
+               '.navigation-not-searchable'
        ];
 
        /**