
| "Hide From Search" Joomla! Custom Development |
| Tuesday, 13 January 2009 | |
|
SM2 created a "hide from search" feature for one of our Joomla! 1.0 managed website. Using the custom SM2 developed code, the site administrators are able to make articles, sections or categories hidden from the default Joomla! site search. This is useful if you have content that is available for internal review and not ready for the public eyes yet. Joomla! is so much more than just a powerful content management system. The search site is feature available "out of the box." The standard search feature helps navigate users to most popular search items and provide the site administrators with search statistics. To achieve these features, SM2 made changes to the Joomla! core and to the plugin system as outlined below in "geek speak".Data processing
So that this can be processed correctly in the save and apply functions it needs to be added to the appropriate Joomla! table classes. jos_content class already has the mask field but the hide_from_search field needs to be added as a variable to the category and section table classes. No other modification is necessary database because Joomla! will do the rest automatically. DisplayIn the edit forms for the articles, sections and categories we added an extra field to the publishing parameter tab. At the end of the tab we simply added a yes or no radio option for the mask or hide_from_search field. This simple update handles the display and the save of the information automatically in the data processing section above. Search
Finally modification is necessary to the content search plugin (mambot). Extra conditions where added to the queries to #_content.mask=0 AND #_sections.hide_from_search=0 AND #_categories.hide_from_search=0. The search categories and sections plugins also required similar code. The outcome
|
You need to have somewhere to store the option. In the case of the articles
to be hidden from the search, we used a depreciated field in the content table
called mask. For the ability to hide a section and category from the
search, we added a new field called hide_from_search.