Skip to content
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.

theme-next/hexo-generator-search

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hexo-generator-searchdb

npm npm npm

Generate search data for Hexo 3.0. This plugin is used for generating a search index file, which contains all the neccessary data of your articles that you can use to write a local search engine for your blog. Supports both XML and JSON format output.

Install

$ npm install hexo-generator-searchdb --save

Options

You can configure this plugin in your root _config.yml. All the arguments are optional.

search:
  path: search.xml
  field: post
  format: html
  limit: 10000
  content: true
  • path - file path. By default is search.xml . If the file extension is .json, the output format will be JSON. Otherwise XML format file will be exported.
  • field - the search scope you want to search, you can chose:
    • post (Default) - will only covers all the posts of your blog.
    • page - will only covers all the pages of your blog.
    • all - will covers all the posts and pages of your blog.
  • format - the form of the page contents, works with xml mode, options are:
    • html (Default) - original html string being minified.
    • raw - markdown text of each posts or pages.
    • excerpt - only collect excerpt.
    • more - act as you think.
  • limit - define the maximum number of posts being indexed, always prefer the newest.
  • content - whether contains the whole content of each article. If false, the generated results only cover title and other meta info without mainbody. By default is true.

Notice

For node.js version < 4.2.2, please use v0.X.X.

Exclude indexing

To exclude a certain post or page from being indexed, you can simply insert indexing: false setting at the top of its front-matter, e.g.:

title: "Code Highlight"
date: "2014-03-15 20:17:16"
tags: highlight
categories: Demo
description: "A collection of Hello World applications from helloworld.org."
toc: true
indexing: false
---

Then the generated result will not contain this post or page.

FAQ

What's this plugin supposed to do?

This plugin is used for generating a xml / json file from your Hexo blog that provides data for searching.

Where's this file saved to?

After executing hexo g you will get the generated result at your public folder.

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%