# Simple-Jekyll-Search

A JavaScript library to add search functionality to any Jekyll blog.

idea from this blog post

# Getting started

• Place the following code in a file called search.json in the root of your Jekyll blog. This file will be used as a small data source to perform the searches on the client side:
---
---
[

{
"title"    : "Mihcak&#39;s denoising filter for 2D images",
"category" : "blog",
"tags"     : "",
"url"      : "/mihcak-filter/",
"date"     : "2018-06-17 03:00:00 +0000"
} ,

{
"title"    : "Camera Fingerprint Clustering",
"category" : "project",
"tags"     : "",
"url"      : "/ssc-camera-fingerprint/",
"date"     : "2017-04-20 18:00:00 +0000"
} ,

{
"title"    : "Face spoofing detection",
"category" : "project",
"tags"     : "",
"url"      : "/face_spoofing_detection/",
"date"     : "2017-04-20 18:00:00 +0000"
}

]

• configure the library ( options )

Note that the index generated in search.json does not include the posts’ content since you may not want to load the whole content of your blog in each single page. However, if some of you want to enable full-text search, you can still add the posts’ content to the index, either to the normal search, or on an additional search page with a dedicated second index file. To do this, simply add

"content"  : ""


to search.json after the "date" line to which you must add a comma (,).

# Install with bower

bower install simple-jekyll-search


# Setup

You need to place the following code within the layout where you want the search to appear.

For example in _layouts/default.html:

<!-- Html Elements for Search -->
<div id="search-container">
<input type="text" id="search-input" placeholder="search...">
<ul id="results-container"></ul>
</div>

<!-- Script pointing to jekyll-search.js -->
<script src="/bower_components/simple-jekyll-search/dest/jekyll-search.js" type="text/javascript"></script>


# Options

Customize SimpleJekyllSearch by passing in your configuration options:

SimpleJekyllSearch({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
json: '/search.json',
})


The above initialization needs to occur after the inclusion of jekyll-search.js.

### searchInput (Element) [required]

The input element on which the plugin should listen for keyboard event and trigger the searching and rendering for articles.

### resultsContainer (Element) [required]

The container element in which the search results should be rendered in. Typically an <ul>.

### json (String|JSON) [required]

You can either pass in an URL to the search.json file, or the results in form of JSON directly, to save one round trip to get the data.

### searchResultTemplate

The template of a single rendered search result.

The templating syntax is very simple: You just enclose the properties you want to replace with curly braces.

E.g.

The template

<li><a href="{url}">{title}</a></li>


will render to the following

<li><a href="/jekyll/update/2014/11/01/welcome-to-jekyll.html">Welcome to Jekyll!</a></li>


If the search.json contains this data

[

{
"title"    : "Welcome to Jekyll!",
"category" : "",
"tags"     : "",
"url"      : "/jekyll/update/2014/11/01/welcome-to-jekyll.html",
"date"     : "2014-11-01 21:07:22 +0100"
}

]


### noResultsText

The HTML that will be shown if the query didn’t match anything.

### limit

You can limit the number of posts rendered on the page.

### fuzzy

Enable fuzzy search to allow less restrictive matching.

### exclude

Pass in a list of terms you want to exclude (terms will be matched against a regex, so urls, words are allowed).

## Enable full content search of posts and pages

• Replace ‘search.json’ with the following code:
---
layout: null
---
[

{
"title"    : "Mihcak&#39;s denoising filter for 2D images",
"category" : "blog",
"tags"     : "",
"url"      : "/mihcak-filter/",
"date"     : "2018-06-17 03:00:00 +0000",
"content"  : "MotivationA compressible signal is generally composed by only a few principle components. Keeping only principle components and discarding redundant components is the goal of many compression algorithms. We can think of a compressible signal as the composition of many "similar structures", and there exist cheaper ways to represent them. On the contrary, noise is not compressible as it contain only "random structures".The target of this post is not about compression, but about a denoising algorithm for 2D images as this algorithm shares the same motivation as compression. Both of them aim to identifying random structures in a signal and attempt to remove them.Wavelet decompositionPrinciple components in a natural image are mostly contained in low-frequency band, which are visible to human eyes. Therefore, compression or denoising is usually done on frequency domain. Discrete Fourier Transform is famous for analyzing frequency components of an image. However, it doesn't present the spectrum at different portions or different scales. Wavelet decomposition does.Going deep into wavelet decomposition stays beyond this post. In the view of linear algebra, if a signal $f(t)$ is on the space spanned by a basis $\Phi(k)$, it can be expressed by linear combination of the basis.$$f(t) = \sum_{k=1}^N a_k \Phi_k(t), \quad k \; \text{is the integer index} \tag{1} \label{1}$$If the set of $\{\Phi_k\}$ is carefully chosen, there exist another set of $\{\tilde{\Phi}_k\}$ such that they are orthonormal:$$\langle \Phi_i(t), \tilde{\Phi}_j(t)\rangle = \int \Phi_i(t) \tilde{\Phi}^*_j(t) dt = \begin{cases} \delta_{ij} \quad &amp;\text{if } i=j \\ 0 \quad &amp;\text{if } i \neq j \end{cases} \tag{2} \label{2}$$where $^*$ is the complex conjugate and $\delta_{ij}$  is the unit function.The property ($\ref{2}$) allows to compute $a_k = \langle f(t), \tilde{\Phi}_k(t) \rangle$ as the transform, and (\ref{1}) as the inverse transform.  In 2D wavelet decomposition, we have two kinds of basis functions $\Phi(x,y)$ and $\Psi(x,y)$ corresponding to scaling and wavelet functions. Scaling function $\Phi(x,y)$ plays the role of a low-pass filter $h[m,n]$, while wavelet function $\Psi(x,y)$ corresponds to a high-pass filter $g[m,n]$. There is a tied relation between the set $\{\Phi(x,y), \Psi(x,y)\}$ and $\{g[m,n], h[m,n]\}$. Instead of computing the transform by using $\Phi(x,y)$ and $\Psi(x,y)$, the same result can be obtained by resorting to filtering process with $h[m,n]$ and $g[m,n]$.  Suppose the basis functions are ready, the image $I$ is decomposed into four bands for each decomposition level: LL, HL, LH, HH  (L: low-pass, H: high-pass). The band LL contains low-frequency components of the image, while HL, LH, HH represent variations along $x$-axis, $y$-axis, and diagonal. One can decide to decompose $I$ with more than one level, where the subsequent level is performed on the current LL band instead of $I$. After one decomposition level, the resolution is halved to haft. Shown in Figure 1 is the level 1 decomposition of 512x512 image of lina. There are 4 corresponding bands, and each is 256x256.Figure 1. Wavelet decomposition level 1 of lina.Mihcak’s denoising filterHL, LH, HH account for high-frequency components including noise, thus denoising will be employed on these three bands. For most of denoising algorithms, the distributions of noise and data have to be made. Mihcak's et. al. made assumptions that the noise is Additive White Gaussian Noise (AWGN), and the wavelet coefficients (elements of HL, LH, HH) are independent and identically distributed (i.i.d) Gaussian random variables. Since wavelet coefficients is locally distributed, it is hard to assume a wavelet coefficients as global i.i.d. Therefore, Mihcak et. al. relax the assumption so that wavelet coefficients are local i.i.d. This assumption is known as spatial adaptivity, and thus Mihcak's filter is capable to adapt itself to different image regions.Figure 2. Statistical model. [2]In statistical model in Figure 2, $x[k]$ is a wavelet coefficient of the clean image, which is a local i.i.d Gaussian random variable, i.e. $x[k] \sim N(0, \sigma(k)^2)$. The observed wavelet coefficient $y[k]$ is essentially $x[k]$ corrupted by AWGN $n[k] \sim N(0,\sigma_n^2)$.Mihcak's filtering are described in the followings:Input: $y[k], \sigma_n^2$Output: the estimate $\hat{x}[k]$Step 1. Estimate the local variance $\sigma[k]^2$of $x[k]$The estimation of $\sigma[k]^2$ is done at at $M$ different local neighborhood areas. Let denote $\sigma_m[k]^2$ the variance in the local neighborhood $m$ ($1 \leq m \leq M$). The estimation can be theoretically done by minimizing the mean square error of $\hat{x}[k]$ and $x[k]$.$$\underset{\sigma_m[k]}{\min.} \quad \mathbb{E}\left[(\hat{x}[k] - x[k])^2\right]$$This optimization problem is intractable since we do not have $x[k]$. Based on a reasonable hypothesis that local neighborhoods have similar variance, what we need to choose is a local variance closest to the true one.$$\begin{eqnarray} \hat{\sigma}[k] &amp;=&amp; \underset{\Theta_m}{\text{arg}\min} \quad \mathbb{E}\left[ (\sigma[k] - \Theta_m(k))^2 \right]\\ &amp;=&amp; \underset{\Theta_m}{\text{arg}\min} \quad \left\{ \sigma[k]^2 - 2\sigma[k] \mathbb{E}[\Theta_m[k]] + \mathbb{E}[\Theta_m[k]^2] \right\}\\ &amp;=&amp; \underset{\Theta_m}{\text{arg}\min} \quad \left\{ \sigma[k]^2 - 2\sigma[k] \mathbb{E}[\Theta_m[k]] + \mathbb{E}[]\Theta_m[k]]^2 + \mathbb{Var}[\Theta_m[k]^2] \right\}\\ &amp;=&amp; \underset{\Theta_m}{\text{arg}\min} \quad \left\{ \underbrace{\left(\mathbb{E}[\Theta_m[k]] - \sigma[k] \right)^2}_{\text{term 1}} + \underbrace{\mathbb{Var} \left[ \Theta_m[k]^2 \right]}_{\text{term 2}} \right\}\label{3} \tag{3}\end{eqnarray}$$This optimization is not solvable if $\sigma[k]$ is involved in. Fortunately, the authors experimentally showed that $\text{term 2}$ dominates $\text{term 1}$ in ($\ref{3}$). Therefore, ($\ref{3}$) is approximated to:$$\hat{\sigma}[k] = \underset{\Theta_m}{\text{arg}\min} \quad \mathbb{Var} \left[ \Theta_m[k]^2 \right]$$To estimate $\Theta_m^2[k]$ in block $m$, we need to compute the variance $\Theta_m[l]^2$ of every wavelet coefficient $l$ in the block. Given the observation $y[l] = x[l] + n[l]$, the estimate of $\Theta_m[l]^2$ is obtained by maximum log likelihood.$$\underset{\Theta_m[l]}{\max.} \quad \log \left( \frac{1}{\sqrt{2\pi(\Theta_m[l]^2 + \sigma_n^2)}} \right) - \frac{y[l]}{2(\Theta_m[l]^2 + \sigma_n^2)} \label{4} \tag{4}$$Solving (\ref{4}), we get the closed-form solution $\Theta_m[l]^2 = y[l]^2 - \sigma_n^2$ and $\Theta_m[l]^2 \neq 0$. After that, $\Theta_m[k]^2$ is estimated as the non-negative mean of $\Theta_m[l]^2$.$$\Theta_m[k]^2 = \max \left\{ 0, \frac{1}{\left|\mathcal{N}_{km} \right|}\underset{l \in \mathcal{N}_{km}}{\sum} y[l]^2 - \sigma_n^2 \right \}, \quad \mathcal{N}_{km} \text{ is the neighborhood } m \text{ of coefficient } k.$$Now we have $\Theta_m[k]^2$ at block $m$, we next evaluate our estimator $\Theta_m[k]^2$ by computing its variance. This is done by a simple method called bootstrapping. The idea is to resample local neighborhood $m$ with replacement (choosing randomly and independently many local areas $m'$ such that $\left | \mathcal{N}_{km'} \right | = \left | \mathcal{N}_{km} \right |$ ) and estimate $\Theta_{m'}[k]^2$. The variance $\mathbb{Var}(\Theta_m[k]^2)$ can be computed from our population. Finally, $\Theta_m[k]^2$ that has minimal variance is a good estimate of $\hat{\sigma}[k]^2$.Step 2. Estimate $\hat{x}[k]$.Estimating $\hat{x}[k]$ is equivalent to computing conditional expectation $\hat{x}[k] = \mathbb{E}(x[k] | y[k])$. This computation is very difficult if we don't make further assumption about the class of the estimator. Here the estimator is assumed to be linear:$$\hat{x}[k] = wy[k] + b$$We need to find $w$ and $b$ minimizing mean square error. This estimation method is referred to as Linear Minimum Mean Square Error (LMMSE). The optimal estimator has to satisfy two conditions:  The estimator is unbiased. This means   $$\begin{eqnarray} \mathbb{E}[\hat{x}[k]] &amp;=&amp; \mathbb{E}[x[k]] \\ w\mathbb{E}[y[k]] + b &amp;=&amp; \mathbb{E}[x[k]] = 0 \\ \text{then } b &amp;=&amp; 0 \end{eqnarray}$$  The estimation error is minimum. In Figure 3, the estimation error is minimum when it is orthogonal to $y[k]$. For univariate case, this means  $$\begin{eqnarray} \mathbb{E}[(\hat{x}[k] - x[k])y[k]] &amp;=&amp; 0 \\ \mathbb{E}[(wy[k] - x[k])y[k]] &amp;=&amp; 0 \\ w\mathbb{E}[y[k]^2] - \mathbb{E}[x[k](x[k] + n[k])] &amp;=&amp; 0 \\ w &amp;=&amp; \frac{\mathbb{E}[x[k]^2] + \mathbb{E}[x[k]]\mathbb{E}[n[k]]}{E[y[k]^2]} \\ w &amp;=&amp; \frac{\mathbb{Var}(x[k])}{\mathbb{Var}(y[k])} = \frac{\sigma[k]^2}{\sigma[k]^2 + \sigma_n^2} \end{eqnarray}$$Figure 3. Illustration of LMMSE estimator.However, we do not have the true $\sigma[k]^2$, but only its estimate $\hat{\sigma}[k]^2$ in Step 1. Finally,$$\hat{x}[k] = \frac{\hat{\sigma}[k]^2}{\hat{\sigma}[k]^2 + \sigma_n^2} y[k]$$Once all wavelet coefficients $\hat{x}[k]$ of LH,HL,HH are estimated, we can apply inverse wavelet transform to obtain the clean image. Please refer to Figure 4 for an illustration, where Mihcak filter is applied on the first decomposition level of Lena image.Figure 4. Lena example.References      Chun-Lin, Liu, A Tutorial of the Wavelet Transform. 2010.    M. K. Mihcak, I. Kozintsev, K. Ramchandran, Spatially adaptive statistical modeling of wavelet image coefficients and its application to denoising. 1999.   "
} ,

{
"title"    : "Camera Fingerprint Clustering",
"category" : "project",
"tags"     : "",
"url"      : "/ssc-camera-fingerprint/",
"date"     : "2017-04-20 18:00:00 +0000",
"content"  : "Summarization  Each digital image contains a unique intrinsic trace left by the camera through the image acquisition process, the so-called camera fingerprint. Such camera fingerprint uniquely identifies the acquisition camera and can be exploited for multiple forensic purposes. Up-to-date technologies enable camera fingerprint estimation if an analyst has the suspected device in hand, or a set of original images proved to be taken by that camera. In practical applications, it is difficult to fulfill those requirements since often only a set of unsourced images is available to forensic investigators. In order to deal with those circumstances, grouping images with respect to their acquisition cameras is a preliminary step before performing other forensic steps, i.e., estimating the number of cameras, estimating reliable camera fingerprints, linking a suspected image to one cluster with a certain level of confidence.  In the literature, unsupervised learning techniques have been proposed in order to group images taken by the same camera together. Most of those techniques use normalized correlation of two fingerprints as similarity measurement. In this work, we aim to solve the problem by finding sparse representations of Sensor Pattern Noises (SPNs) which characterize underlying data segmentation.  Although camera fingerprints are represented in high dimensional space, their intrinsic dimension is often much smaller. SPNs of the same camera can be interpreted as lying in a subspace whose dimension is much smaller than the dimension of the ambient space.Figure 1. Sparse representation model of camera fingerprints.  We show that solving $\ell_1-$ regularized least squares can recover sparse representations of data.References  Quoc-Tin Phan, Giulia Boato, and Francesco G. B. De Natale, Image Clustering by Source Camera via Sparse Representation, [PDF]"
} ,

{
"title"    : "Face spoofing detection",
"category" : "project",
"tags"     : "",
"url"      : "/face_spoofing_detection/",
"date"     : "2017-04-20 18:00:00 +0000",
"content"  : "Summarization  Face recognition is one of the most commonly used techniques in applications of biometrics, e.g. access control, law enforcement, multimedia communication, human-computer interaction. Like other biometric modalities, however, a face recognition system can be attacked easily and at very low cost by two common attacks, namely print attack and replay attack. In print attacks, face spoofing is carried out by presenting a printed photo to a camera. In replay attacks, on the other hand, the attackers replay a previously recorded face image or video of a targeted user in order to spoof the biometric system. As attackers only need to acquire a printed photo or a video of the authorized user's face, with current technologies these types of attack can be carried out easily in both remote and logical access control systems protected by a face recognition system.  We propose an approach for face spoofing detection using the high-order Local Derivative Pattern from Three Orthogonal Planes (LDP-TOP). The proposed method is not only simple to derive and implement, but also highly efficient, since it takes into account both spatial and temporal information in different directions of subtle face movements.References  Quoc-Tin Phan, D.-T. Dang-Nguyen, G. Boato, and F. G. B. De Natale, Face Spoofing Detection Using LDP-TOP, In IEEE International Conference on Image Processing 2016. [PDF] [CODE]"
}

,

{

"category" : "",
"tags"     : "",
"date"     : "",
"content"  : "My name is Quoc Tin Phan (Phan Quốc Tín in Vietnamese), the 3rd-year PhD student in ICT Doctoral School, University of Trento, Italy.I am working under the joint supervision of Prof. Giulia Boato and Prof. Francesco G. B. De Natale. My expected year of graduation is 2018. My research focuses on multimedia forensics which refers to analyses on the semantic level or pixel level of images for legality matters. Data representation, feature extraction and unsupervised learning techniques are three main themes in my research. Please find my CV here.Contact me by email  quoctin.phan@unitn.it  "

} ,

{

"title"    : "Projects",
"category" : "",
"tags"     : "",
"url"      : "/projects/",
"date"     : "",
"content"  : "                  "

} ,

{

"title"    : "Blogs",
"category" : "",
"tags"     : "",
"url"      : "/blogs/",
"date"     : "",
"content"  : "                             17 Jun, 2018 — Mihcak's denoising filter for 2D images — Motivation A compressible signal is generally composed by only a few principle components. Keeping only principle components and discarding redundant components is the goal of many compression algorithms. We can think of a compressible signal as the composition of many...  Read more...                                   20 Apr, 2017 — Camera Fingerprint Clustering — Summarization Each digital image contains a unique intrinsic trace left by the camera through the image acquisition process, the so-called camera fingerprint. Such camera fingerprint uniquely identifies the acquisition camera and can be exploited for multiple forensic purposes. Up-to-date technologies...  Read more...                                   20 Apr, 2017 — Face spoofing detection — Summarization Face recognition is one of the most commonly used techniques in applications of biometrics, e.g. access control, law enforcement, multimedia communication, human-computer interaction. Like other biometric modalities, however, a face recognition system can be attacked easily and at very...  Read more...                        "

} ,

{

} ,

{

} ,

{

"title"    : "Publications",
"category" : "",
"tags"     : "",
"url"      : "/publications/",
"date"     : "",
"content"  : "            Quoc-Tin Phan, Giulia Boato, Francesco G. B. De Natale, Robust Image Clustering based on Sparse Representation of Camera Fingerprint. Submitted to IEEE Transactions on Information Forensics and Security.              Emanuele Sansone, Quoc-Tin Phan, Francesco G. B. De Natale, Plummer Autoencoders. Submitted to Conference on Neural Information Processing Systems 2018.              Quoc-Tin Phan, Cecilia Pasquini, Giulia Boato, Francesco G. B. De Natale, Identifying image provenance: an analysis of mobile instant messaging apps. In IEEE Int. Workshop on Multimedia Signal Processing 2018.              Federica Lago, Quoc-Tin Phan, Giulia Boato, Image Forensics on Online News. In IEEE Int. Workshop on Multimedia Signal Processing 2018.              Quoc-Tin Phan, Duc-Tien Dang-Nguyen, Giulia Boato, Francesco G. B. De Natale, Using LDP-TOP In Video Based Spoofing Detection. In Int. Conference on Image Analysis and Processing. [PDF][CODE]              Quoc-Tin Phan, Giulia Boato, Francesco G. B. De Natale, Image Clustering by Source Camera via Sparse Representation. Int. Workshop on Multimedia Forensics and Security 2017. [PDF]              Quoc-Tin Phan, Duc-Tien Dang-Nguyen, Giulia Boato, Francesco G. B. De Natale, Face Spoofing Detection Using LDP-TOP. In IEEE Int. Conference on Image Processing 2016. [PDF]&thinsp;[CODE]              Quoc-Tin Phan, Alessandro Budroni, Cecilia Pasquini, Francesco G. B. De Natale, A Hybrid Approach for Multimedia Use Verification. In MediaEval 2016. [PDF]              Tin Q. Phan, Van H. Dang, Thuc D. Nguyen, A Novel Construction for PEKS Scheme using Matrix Group. In Ubiquitous Information Technologies and Applications 2014.      "

} ,

{

} ,

{

} ,

{

"title"    : "Simple-Jekyll-Search",
"category" : "",
"tags"     : "",
"url"      : "/assets/components/simple-jekyll-search/",
"date"     : "",
"content"  : "Simple-Jekyll-Search====================[![Build Status](https://travis-ci.org/christian-fei/Simple-Jekyll-Search.svg?branch=master)](https://travis-ci.org/christian-fei/Simple-Jekyll-Search)A JavaScript library to add search functionality to any Jekyll blog.---idea from this [blog post](https://alexpearce.me/2012/04/simple-jekyll-searching/#disqus_thread)---### Promotion: check out [Pomodoro.cc](https://pomodoro.cc/)# [Demo](http://christian-fei.github.io/Simple-Jekyll-Search/)# Getting started- Place the following code in a file called search.json in the **root** of your Jekyll blog. This file will be used as a small data source to perform the searches on the client side:------[  {% for post in site.posts %}    {      "title"    : "{{ post.title | escape }}",      "category" : "{{ post.category }}",      "tags"     : "{{ post.tags | join: ', ' }}",      "url"      : "{{ site.baseurl }}{{ post.url }}",      "date"     : "{{ post.date }}"    } {% unless forloop.last %},{% endunless %}  {% endfor %}]- configure the library ( [options](#options) )### Enabling full-text searchNote that the index generated in search.json does not include the posts' content since you may not want to load the whole content of your blog in each single page. However, if some of you want to enable full-text search, you can still add the posts' content to the index, either to the normal search, or on an additional search page with a dedicated second index file. To do this, simply add"content"  : "{{ post.content | strip_html | strip_newlines }}"to search.json after the "date" line to which you must add a comma (,).# Install with bowerbower install simple-jekyll-search# SetupYou need to place the following code within the layout where you want the search to appear.For example in  **_layouts/default.html**:# OptionsCustomize SimpleJekyllSearch by passing in your configuration options:SimpleJekyllSearch({  searchInput: document.getElementById('search-input'),  resultsContainer: document.getElementById('results-container'),  json: '/search.json',})The above initialization needs to occur after the inclusion of jekyll-search.js.### searchInput (Element) [required]The input element on which the plugin should listen for keyboard event and trigger the searching and rendering for articles.### resultsContainer (Element) [required]The container element in which the search results should be rendered in. Typically an .### json (String|JSON) [required]You can either pass in an URL to the search.json file, or the results in form of JSON directly, to save one round trip to get the data.### searchResultTemplateThe template of a single rendered search result.The templating syntax is very simple: You just enclose the properties you want to replace with curly braces.E.g.The template{title}will render to the followingWelcome to Jekyll!If the search.json contains this data[    {      "title"    : "Welcome to Jekyll!",      "category" : "",      "tags"     : "",      "url"      : "/jekyll/update/2014/11/01/welcome-to-jekyll.html",      "date"     : "2014-11-01 21:07:22 +0100"    }]### noResultsTextThe HTML that will be shown if the query didn't match anything.### limitYou can limit the number of posts rendered on the page.### fuzzyEnable fuzzy search to allow less restrictive matching.### excludePass in a list of terms you want to exclude (terms will be matched against a regex, so urls, words are allowed).## Enable full content search of posts and pages- Replace 'search.json' with the following code:---layout: null---[  {% for post in site.posts %}    {      "title"    : "{{ post.title | escape }}",      "category" : "{{ post.category }}",      "tags"     : "{{ post.tags | join: ', ' }}",      "url"      : "{{ site.baseurl }}{{ post.url }}",      "date"     : "{{ post.date }}",      "content"  : "{{ post.content | strip_html | strip_newlines }}"    } {% unless forloop.last %},{% endunless %}  {% endfor %}  ,  {% for page in site.pages %}   {     {% if page.title != nil %}        "title"    : "{{ page.title | escape }}",        "category" : "{{ page.category }}",        "tags"     : "{{ page.tags | join: ', ' }}",        "url"      : "{{ site.baseurl }}{{ page.url }}",        "date"     : "{{ page.date }}",        "content"  : "{{ page.content | strip_html | strip_newlines }}"     {% endif %}   } {% unless forloop.last %},{% endunless %}  {% endfor %}]### If search isn't working due to invalid JSON- There is a filter plugin in the _plugins folder which should remove most characters that cause invalid JSON. To use it, add the simple_search_filter.rb file to your _plugins folder, and use remove_chars as a filter.For example: in search.json, replace"content"  : "{{ page.content | strip_html | strip_newlines }}"with"content"  : "{{ page.content | strip_html | strip_newlines | remove_chars | escape }}"##Browser supportBrowser support should be about IE6+ with this addEventListener [shim](https://gist.github.com/eirikbacker/2864711#file-addeventlistener-polyfill-js)# Dev setup- npm install the dependencies.- gulp watch during development- npm test or npm run test-watch to run the unit tests#License##MIT licensedPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."

} ,

{

} ,

{

}

]


### If search isn’t working due to invalid JSON

• There is a filter plugin in the _plugins folder which should remove most characters that cause invalid JSON. To use it, add the simple_search_filter.rb file to your _plugins folder, and use remove_chars as a filter.

For example: in search.json, replace

"content"  : "Simple-Jekyll-Search====================[![Build Status](https://travis-ci.org/christian-fei/Simple-Jekyll-Search.svg?branch=master)](https://travis-ci.org/christian-fei/Simple-Jekyll-Search)A JavaScript library to add search functionality to any Jekyll blog.---idea from this [blog post](https://alexpearce.me/2012/04/simple-jekyll-searching/#disqus_thread)---### Promotion: check out [Pomodoro.cc](https://pomodoro.cc/)# [Demo](http://christian-fei.github.io/Simple-Jekyll-Search/)# Getting started- Place the following code in a file called search.json in the **root** of your Jekyll blog. This file will be used as a small data source to perform the searches on the client side:------[  {% for post in site.posts %}    {      "title"    : "{{ post.title | escape }}",      "category" : "{{ post.category }}",      "tags"     : "{{ post.tags | join: ', ' }}",      "url"      : "{{ site.baseurl }}{{ post.url }}",      "date"     : "{{ post.date }}"    } {% unless forloop.last %},{% endunless %}  {% endfor %}]- configure the library ( [options](#options) )### Enabling full-text searchNote that the index generated in search.json does not include the posts' content since you may not want to load the whole content of your blog in each single page. However, if some of you want to enable full-text search, you can still add the posts' content to the index, either to the normal search, or on an additional search page with a dedicated second index file. To do this, simply add"content"  : "{{ post.content | strip_html | strip_newlines }}"to search.json after the "date" line to which you must add a comma (,).# Install with bowerbower install simple-jekyll-search# SetupYou need to place the following code within the layout where you want the search to appear.For example in  **_layouts/default.html**:# OptionsCustomize SimpleJekyllSearch by passing in your configuration options:SimpleJekyllSearch({  searchInput: document.getElementById('search-input'),  resultsContainer: document.getElementById('results-container'),  json: '/search.json',})The above initialization needs to occur after the inclusion of jekyll-search.js.### searchInput (Element) [required]The input element on which the plugin should listen for keyboard event and trigger the searching and rendering for articles.### resultsContainer (Element) [required]The container element in which the search results should be rendered in. Typically an .### json (String|JSON) [required]You can either pass in an URL to the search.json file, or the results in form of JSON directly, to save one round trip to get the data.### searchResultTemplateThe template of a single rendered search result.The templating syntax is very simple: You just enclose the properties you want to replace with curly braces.E.g.The template{title}will render to the followingWelcome to Jekyll!If the search.json contains this data[    {      "title"    : "Welcome to Jekyll!",      "category" : "",      "tags"     : "",      "url"      : "/jekyll/update/2014/11/01/welcome-to-jekyll.html",      "date"     : "2014-11-01 21:07:22 +0100"    }]### noResultsTextThe HTML that will be shown if the query didn't match anything.### limitYou can limit the number of posts rendered on the page.### fuzzyEnable fuzzy search to allow less restrictive matching.### excludePass in a list of terms you want to exclude (terms will be matched against a regex, so urls, words are allowed).## Enable full content search of posts and pages- Replace 'search.json' with the following code:---layout: null---[  {% for post in site.posts %}    {      "title"    : "{{ post.title | escape }}",      "category" : "{{ post.category }}",      "tags"     : "{{ post.tags | join: ', ' }}",      "url"      : "{{ site.baseurl }}{{ post.url }}",      "date"     : "{{ post.date }}",      "content"  : "{{ post.content | strip_html | strip_newlines }}"    } {% unless forloop.last %},{% endunless %}  {% endfor %}  ,  {% for page in site.pages %}   {     {% if page.title != nil %}        "title"    : "{{ page.title | escape }}",        "category" : "{{ page.category }}",        "tags"     : "{{ page.tags | join: ', ' }}",        "url"      : "{{ site.baseurl }}{{ page.url }}",        "date"     : "{{ page.date }}",        "content"  : "{{ page.content | strip_html | strip_newlines }}"     {% endif %}   } {% unless forloop.last %},{% endunless %}  {% endfor %}]### If search isn't working due to invalid JSON- There is a filter plugin in the _plugins folder which should remove most characters that cause invalid JSON. To use it, add the simple_search_filter.rb file to your _plugins folder, and use remove_chars as a filter.For example: in search.json, replace"content"  : "{{ page.content | strip_html | strip_newlines }}"with"content"  : "{{ page.content | strip_html | strip_newlines | remove_chars | escape }}"##Browser supportBrowser support should be about IE6+ with this addEventListener [shim](https://gist.github.com/eirikbacker/2864711#file-addeventlistener-polyfill-js)# Dev setup- npm install the dependencies.- gulp watch during development- npm test or npm run test-watch to run the unit tests#License##MIT licensedPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."


with

"content"  : "Simple-Jekyll-Search====================[![Build Status](https://travis-ci.org/christian-fei/Simple-Jekyll-Search.svg?branch=master)](https://travis-ci.org/christian-fei/Simple-Jekyll-Search)A JavaScript library to add search functionality to any Jekyll blog.---idea from this [blog post](https://alexpearce.me/2012/04/simple-jekyll-searching/#disqus_thread)---### Promotion: check out [Pomodoro.cc](https://pomodoro.cc/)# [Demo](http://christian-fei.github.io/Simple-Jekyll-Search/)# Getting started- Place the following code in a file called search.json in the **root** of your Jekyll blog. This file will be used as a small data source to perform the searches on the client side:------[  {% for post in site.posts %}    {      &quot;title&quot;    : &quot;{{ post.title | escape }}&quot;,      &quot;category&quot; : &quot;{{ post.category }}&quot;,      &quot;tags&quot;     : &quot;{{ post.tags | join: &#39;, &#39; }}&quot;,      &quot;url&quot;      : &quot;{{ site.baseurl }}{{ post.url }}&quot;,      &quot;date&quot;     : &quot;{{ post.date }}&quot;    } {% unless forloop.last %},{% endunless %}  {% endfor %}]- configure the library ( [options](#options) )### Enabling full-text searchNote that the index generated in search.json does not include the posts&#39; content since you may not want to load the whole content of your blog in each single page. However, if some of you want to enable full-text search, you can still add the posts&#39; content to the index, either to the normal search, or on an additional search page with a dedicated second index file. To do this, simply add&quot;content&quot;  : &quot;{{ post.content | strip_html | strip_newlines }}&quot;to search.json after the &quot;date&quot; line to which you must add a comma (,).# Install with bowerbower install simple-jekyll-search# SetupYou need to place the following code within the layout where you want the search to appear.For example in  **_layouts/default.html**:# OptionsCustomize SimpleJekyllSearch by passing in your configuration options:SimpleJekyllSearch({  searchInput: document.getElementById(&#39;search-input&#39;),  resultsContainer: document.getElementById(&#39;results-container&#39;),  json: &#39;/search.json&#39;,})The above initialization needs to occur after the inclusion of jekyll-search.js.### searchInput (Element) [required]The input element on which the plugin should listen for keyboard event and trigger the searching and rendering for articles.### resultsContainer (Element) [required]The container element in which the search results should be rendered in. Typically an .### json (String|JSON) [required]You can either pass in an URL to the search.json file, or the results in form of JSON directly, to save one round trip to get the data.### searchResultTemplateThe template of a single rendered search result.The templating syntax is very simple: You just enclose the properties you want to replace with curly braces.E.g.The template{title}will render to the followingWelcome to Jekyll!If the search.json contains this data[    {      &quot;title&quot;    : &quot;Welcome to Jekyll!&quot;,      &quot;category&quot; : &quot;&quot;,      &quot;tags&quot;     : &quot;&quot;,      &quot;url&quot;      : &quot;/jekyll/update/2014/11/01/welcome-to-jekyll.html&quot;,      &quot;date&quot;     : &quot;2014-11-01 21:07:22 +0100&quot;    }]### noResultsTextThe HTML that will be shown if the query didn&#39;t match anything.### limitYou can limit the number of posts rendered on the page.### fuzzyEnable fuzzy search to allow less restrictive matching.### excludePass in a list of terms you want to exclude (terms will be matched against a regex, so urls, words are allowed).## Enable full content search of posts and pages- Replace &#39;search.json&#39; with the following code:---layout: null---[  {% for post in site.posts %}    {      &quot;title&quot;    : &quot;{{ post.title | escape }}&quot;,      &quot;category&quot; : &quot;{{ post.category }}&quot;,      &quot;tags&quot;     : &quot;{{ post.tags | join: &#39;, &#39; }}&quot;,      &quot;url&quot;      : &quot;{{ site.baseurl }}{{ post.url }}&quot;,      &quot;date&quot;     : &quot;{{ post.date }}&quot;,      &quot;content&quot;  : &quot;{{ post.content | strip_html | strip_newlines }}&quot;    } {% unless forloop.last %},{% endunless %}  {% endfor %}  ,  {% for page in site.pages %}   {     {% if page.title != nil %}        &quot;title&quot;    : &quot;{{ page.title | escape }}&quot;,        &quot;category&quot; : &quot;{{ page.category }}&quot;,        &quot;tags&quot;     : &quot;{{ page.tags | join: &#39;, &#39; }}&quot;,        &quot;url&quot;      : &quot;{{ site.baseurl }}{{ page.url }}&quot;,        &quot;date&quot;     : &quot;{{ page.date }}&quot;,        &quot;content&quot;  : &quot;{{ page.content | strip_html | strip_newlines }}&quot;     {% endif %}   } {% unless forloop.last %},{% endunless %}  {% endfor %}]### If search isn&#39;t working due to invalid JSON- There is a filter plugin in the _plugins folder which should remove most characters that cause invalid JSON. To use it, add the simple_search_filter.rb file to your _plugins folder, and use remove_chars as a filter.For example: in search.json, replace&quot;content&quot;  : &quot;{{ page.content | strip_html | strip_newlines }}&quot;with&quot;content&quot;  : &quot;{{ page.content | strip_html | strip_newlines | remove_chars | escape }}&quot;##Browser supportBrowser support should be about IE6+ with this addEventListener [shim](https://gist.github.com/eirikbacker/2864711#file-addeventlistener-polyfill-js)# Dev setup- npm install the dependencies.- gulp watch during development- npm test or npm run test-watch to run the unit tests#License##MIT licensedPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &#39;Software&#39;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED &#39;AS IS&#39;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."


##Browser support

Browser support should be about IE6+ with this addEventListener shim

# Dev setup

• npm install the dependencies.

• gulp watch during development

• npm test or npm run test-watch to run the unit tests

#License ##MIT licensed Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.