• Hello!

    To help make the backend easier for the clients, we’ve broken out page sections as individual pages and then called them onto the same page using custom page templates. However that’s created a bit of a mess for the search results pages, where we’d either have a bunch of these, essentially “page sections”, show up as individual pages — or we’d have to hide those “page sections” entirely from the search results.

    Is there a way to get the search to find the content that’s on the main page and NOT show the individual “page section” pages??

    i.e. for the Weekly Updates section to show up as part of the results for the Construction page itself, rather than as it’s own page?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • I’ve done something similar, putting one page’s content within another page, so I’m aware of some of the troubles.

    (Option 1)

    If you simply want to remove those pages from search results, you could use the “Search Exclude” plugin. After activation, you could check the box beside all the pages to hide, choose “Edit” from the “Bulk Actions” dropdown, and click Apply. Choose “Hide” where it says “Show in Search Results” and then click Update.

    (Option 2)

    If you want that content to be indexed under the main page instead, I’d recommend using both the “Display Posts Shortcode” and “Relevanssi” plugins (but not Search Exclude because Relevanssi does not seem to honor the other plugin’s hide requests).

    As soon as “Display Posts Shortcode” is installed and activated, you could pull in the sections’ content by using a shortcode rather than using the custom page templates as they are. The shortcode would be something like this:
    [display-posts id=”419″ title=”Weekly Updates” include_content=”true”?post_type=”page”?include_title=”false” include_link=”false”?wrapper=”div” wrapper_class=”half”]

    That would create an h2 heading of “Weekly Updates” and the page segment content within a half-width div container. This varies a bit from the current markup, so adjust accordingly. (For example, you would want the “gray-bg” and “content-area” divs around the pair of shortcodes.)

    Then when Relevanssi is installed and activated, you would need to review all the plugin’s settings and save any changes. The key options are:
    (1) at the bottom of the Indexing tab, the “Expand shortcodes” checkbox should be checked, and
    (2) the “Post exclusion” field (on Searching tab) needs to have “416, 419, 421” and any other pages you wish to hide.

    Once all settings are saved, you will need to go to the Indexing tab and click the “Build the index” button. Try a few searches to verify that it works as desired.

    Hope this helps,
    Stephen

    Side note: if you were just beginning this, I’d recommend using a custom post type for the page segments instead of the Page post type. There is an option to exclude from search when setting up a CPT. At this point, though, it’s probably easier for you to compile a list of each page ID that you need to hide (instead of moving all that content into new posts).

Viewing 1 replies (of 1 total)
  • The topic ‘Customizing Search’ is closed to new replies.