Blog Search
Introduction
Liquid Syntax
{%- include 'module'
id: '3'
layout: 'design_system/1'
per_page: 20
use_search: 'true'
-%}HTML and JavaScript Syntax
<div class="row no-gutters">
<div class="col-12">
<h2>Search Posts by Keyword</h2>
<form title="Search posts by Date" id="blog-archive-search">
<div class="form-group">
<label for="blogSearch">Add Search Keyword</label>
<input id="blogSearch" type="text">
</div>
<input value="Search" class="btn btn-primary" type="submit" data-slug="/module-12"
onclick="blogs_search()">
</form>
</div>
</div>
{% comment %}This example function will search for posts in the future with this keyword. You'll need to use the "use_search" and "use_adv_search" parameters in your Liquid tag.{% endcomment %}
<script>
function blogs_search() {
event.preventDefault();
var keyword = document.querySelector("#blogSearch").value;
var url_string = window.location.pathname+"?keyword="+keyword;
location.assign(url_string);
}
</script>Last updated
Was this helpful?

