Including meta descriptions & keywords in your search results.

Permalink 1 user found helpful
Got an overzealous client who wants meta descriptions & meta tags searchable on every page? Then look no further. In your search page results controller –

<?php
namespace Application\Controller\PageType;
use Concrete\Core\Page\Controller\PageTypeController;
use Concrete\Core\Page\Page;
use Concrete\Core\Legacy\Loader;
use Concrete\Core\Page\PageList;
class Search extends PageTypeController {
    public function view($searchQuery = false) {
        if ($searchQuery) {
            //I know the search isn't case-sensitive.  This is more for the presentation of the term in the view.
            $searchQuery = strip_tags(trim($searchQuery));
            $searchResults = array();
            //Page List for meta descriptions
            $pl = new PageList();
            $pl->filterByAttribute('meta_description', $searchQuery, '=');

meandmybadself