So now that you've implemented Google Custom Search into your site, you may be wondering how you can sort the results. By default, Google does not sort the results at all. You may wish to sort by date to have your most recent posts appear at the top.
Here's how you can do that!
- Log in to Google Custom Search.
- Click on the Control Panel link next to your search engine.
- Click the "Advanced" link on the left hand side, then in the "Context" section, click "Download in XML format".
- Open the downloaded file in a text editor.
- Find the <BackgroundLabels> section of the file. Right before the </BackgroundLabels> line, add the following:
<Label name="recent4" mode="BOOST" />
- Save the file and go back to the Google Custom Search control panel.
- Under the "Context" section, click "Choose File", navigate to the file you've just edited, and click "Upload".
That's all there is to it! Your posts should now be sorted by date, with the most recent posts on the top of the results page.