The YMCA Website Services release 8.2.4 introduces Google Custom Search for the website out of the box.
Enabling the module
Fresh installations
The search feature is included in the Extended
installation type.
For Standard
see the Existing websites section.
If you are installing a fresh YMCA Website Services website and going through the installation process via the Web interface, on the 3rd party integration step you can specify Google Search ID. If you specify the Google Search ID in this form your site’s search feature is up.
Existing websites
The search feature is not automatically enabled after upgrading an YMCA Website Services website. You have to manually enable it.
In order to do that:
- Log in as an admin (or a user with the
administrator
role). - Go to the YMCA Website Services package install page (Admin menu > YMCA Website Services > Extend > Install, or
/admin/openy/extend/list
) - Find the
SEARCH
package there, tick the checkbox and submit the form.
Now the search modules are enabled and the header of the website should have a search field. Upon installation, the modules create a Landing page for search results and point the header search form to the page.
Configuring the Google Search modules
- Go to the Google Search settings form (Admin menu > YMCA Website Services > Settings > Google Search settings, or
/admin/openy/settings/google-search
). - Set the value of the
Google Search ID
field (see the following section for details) and submit the form.
Obtaining Search Engine ID
- Go to https://cse.google.com/, register if you haven’t yet, log in if you aren’t logged in.
- Create the Search Engine (this process is explained in Google documentation
https://support.google.com/customsearch/answer/4513882?hl=en&ref_topic=4513742):
- Click “New Search Engine”.
- Specify the domain of your website (e.g.
www.example.com
). - Specify the name of the Search Engine (e.g.
example.com
). - Click “Create”.
- On the newly created Search Engine page there is the
Search engine ID
field. Use this value in the YMCA Website Services Google Search configuration form.
Configuring the Search Engine look and feel
- Go to
Look and feel
section of the Search Engine - In the
Layout
tab, selectFull width
option and clickSave
If this change hasn’t made, the search results on the website are shown in a popup window.
Dealing with ads
By default, newly created Search engines use Free Edition (with ads) of the service. As YMCAs are non-profit organizations they have the option to switch to Non-profit Edition of the CSE, where it is possible to disable ads.
Take a look here https://support.google.com/customsearch/answer/4542102?hl=en&ctx=topic
If you are already registered as a Non-profit in Google:
- From the CSE Control Panel, select the search engine you want to change.
- Click Setup then Make Money
- Toggle the Show Ads option to off.
Advanced setup
Official Google documentation https://support.google.com/customsearch/topic/4542213?hl=en&ref_topic=4513868
Mutli-site search
You can add not only your website’s domain but other domains as well if you have other websites dedicated to your Association but split from the main website.
You can also add not only the whole websites but their parts by specifying patterns like example.com/blog/*
.
Refinements and facets
Refinements let users filter results according to categories you provide.
Refinements appear in the search results page as tabs. The content of each tab is configured in Search features > Refinement section of the Custom Search Control panel.
To set up a dedicated tab in search results for Blog posts do the following:
- In Control panel, go to
Search features
>Refinements
- Click
Add
- Set the name of the refinement to
Blog
- Select
Search only the sites with this label
forHow to search sites with this label?
- Click
Ok
- Set the name of the refinement to
- Go to
Setup
- Find
Sites to search
, clickAdd
- Add the
yourymcadomain.org/blog/*
in the text field - Select
Blog
in the Label dropdown - Select
Include just this specific page or URL pattern I have entered
- Click
Save
- Add the
The search results page now shows the Blog
tab that only shows blog entries relevant to the search term.
Promotions
Official Google documentation https://support.google.com/customsearch/answer/4542640?hl=en&ref_topic=4542213
Information for developers
Google Custom Search Developers documentation
Enabling via Drush
Use the following snippet to enable the package on existing websites:
drush en openy_google_search
Configuring the module via Drush
Use the following snippet when you install YMCA Website Services via Drush to set the Search Engine ID:
drush site-install openy \
--account-pass=password \
--db-url="mysql://user:pass@host:3306/db" \
--root=/var/www/docroot \
openy_configure_profile.preset=extended \
openy_theme_select.theme=openy_rose \
openy_third_party_services.google_search_engine_id="01234567890123456789:abcedefgh"
The openy_third_party_services.google_search_engine_id
parameter sets the Search Engine ID (01234567890123456789:abcedefgh
in the example).
Use the following snippet to set the Search Engine ID on already installed websites:
drush config-set openy_google_search.settings google_engine_id "01234567890123456789:abcedefgh"