This plugin is an extension to the RainLab.Blog plugin. With this extension you can simply search the blog posts' title and content and display the search results
Components
This Plugins just has two simple Components to output a simple search form and display search results
The following plugin is required
The following themes use this plugin
Search Form
The searchForm
component outputs a simple search form to search your posts.
- Search Results Page - Specify the page where you display the search results (the page with the searchResult component)
Search Results
The searchResults
component returns all posts that match the search term from the search form.
- Search Term - The URL parameter defining the search term.
- Page number - The URL parameter defining the page number.
- disableUrlMapping - If the url Mapping is disabled the search form uses the default GET Parameter search (e.g.
example.com/search?search=Foo
instead ofexample.com/search/Foo
) - Hightlight Matches - Wrap the search terms found in the posts with
<mark>
-Tags or not - Posts per page - Number of posts to display per page.
- No Posts Message - Message to show if no posts where found.
- Sort Order - The order in which the posts are sorted.
- Include Categories - 'Only Posts with selected categories are included in the search result
- Exclude Categories - Specify which categories you want to exclude from your search results, so posts with them don't show up in the results.
- Category Page - The page where the blog posts are filtered by a category.
- Post Page - The page where single blog posts are displayed.
Documentation
Example Usage of Components
title = "Search Result" url = "/blog/search/:search?/:page?" ... other stuff [searchResult] searchTerm = "{{ :search }}" pageNumber = "{{ :page }}" hightlight = 1 postsPerPage = 10 noPostsMessage = "No posts found" sortOrder = "published_at desc" excludeCategories[] = 1 excludeCategories[] = 2 excludeCategories[] = 3 categoryPage = "blog" postPage = "blog/posts" [searchForm] resultPage = "blog/search" categoryFilter = 0 == <div class="container"> <div class="row"> <div class="page-header"> <h2>Blog Search</h2> </div> <div class="col-sm-8">{% component 'searchResult' %}</div> <div class="col-sm-4">{% component 'searchForm' %}</div> </div> </div>
Exclude/Include Categories
In order to exclude/include more than one category you need OctoberCMS Build >= 306 which brings the new Inspector Feature
-
assa
Found the plugin useful on 28 Jun, 2020
When I install this plugin on a local site, the search results return a normal result. But on the real site, the following result appears: Search results for "DEFAULT". What could be causing this error? If you know, can you help?
-
Julio Cesar Sandoval Avila
Found the plugin useful on 14 Apr, 2020
How can I search in multiple languages? I mean, I had installed the translate plugin and I can publish in many laguages but, when I search for a post in other language I can't see any result, I just get results in the main lang
-
Ompmega
Found the plugin useful on 6 Sep, 2019
Adds excellent search functionality to the blog plugin without issues
-
Mob
Found the plugin useful on 30 May, 2018
When I submit a form e.g. "test". URL looks like this: /blog/search?search=test it list all blog posts and Search Results for: is empty
-
Pascal Kleindienst author
Replied on 3 Jun, 2018
Hi, this is strange and should not happen. Could you install the Debugbar Plugin (if you haven't already) and tell me the queries after the form submit -> just drop me a message via https://octobercms.com/author/PKleindienst and I will try to find out why you have this problem
Regards Pascal
-
Ondrej
Found the plugin useful on 13 Apr, 2016
Yes please add support for regular URL query parameters. I'm getting a problem because of that when the user empties the search input. Then the URL parameter will not be removed, but instead the empty URL query parameter gets attached:
URL pattern > blog/:search URL after search submit: blog/searchterm URL after emptying search input and submit: blog/searchterm?search=
-
Pascal Kleindienst author
Replied on 18 Apr, 2016
Hi, sorry for the late response. Since version 1.2.0 it is possible to use the regular query parameters. In the
searchResult
component just activate theDisable URL Mapping
option and remove the :search part from the url pattern.Example URL pattern:
/blog/search/:page?
-> after search submit:/blog/search?search=hello
-
Vojta Svoboda
Found the plugin useful on 10 Mar, 2016
Is there some possibility to have search parameter as GET? Like
website.com/search?q=test
?I tried to set
searchTerm = "{{ q }}"
but it doesn't work. -
Pascal Kleindienst author
Replied on 12 Mar, 2016
Hi, the plugin uses GET requests, but it maps all requests from
website.com/search?q=test
to something likewebsite.com/search/test
if your url schema iswebsite.com/search/{searchterm}
.I could add an option to disable that in the next version :)
-
StreamGuys Dev
Found the plugin useful on 17 Jul, 2015
Definitely nice to have a search functionality added to Rainlab.Blog without having to deal with implementing it myself amidst the rest of a project. Some tweaks were required after initial inclusion in project(pagination issues, resolved with workaround but not entirely as of yet, but am hopeful!), but the plugin Author is readily helpful in problem solving and issue troubleshooting. I suspect this plugin will have a number of projects attached to it before long.
-
1.4.0 |
Add homepage to plugin details by @gergo85 Apr 05, 2018 |
---|---|
1.3.0 |
!!! Removed support for old Inspector Features prior to October 306 Aug 01, 2016 |
1.2.3 |
Fixed bug which caused included/excluded categories not being saved Apr 01, 2016 |
1.2.2 |
optimized query for included/excluded categories Mar 21, 2016 |
1.2.1 |
fixed bug with missing categories Mar 14, 2016 |
1.2.0 |
added option to show only results from selected categories Mar 14, 2016 |
1.1.1 |
remove '?' from url if query is empty Feb 07, 2016 |
1.1.0 |
added category filter Oct 26, 2015 |
1.0.6 |
included `excerpt` into search Aug 20, 2015 |
1.0.5 |
fixed wrong routing Jul 17, 2015 |
1.0.4 |
Replaced POST Method with GET Jul 17, 2015 |
1.0.3 |
Removed _ filter because it caused to much problems when Translate Plugin is missing Jul 10, 2015 |
1.0.2 |
Fixed error with missing Translate Plugin Jul 10, 2015 |
1.0.1 |
First version of Blog Search Jul 10, 2015 |
With Version 1.3.0 you need to have at least October version 306. Otherwise the plugin won't work