thom4parisot / hexo-algolia

Index your hexo website content to Algolia Search.
https://npmjs.com/hexo-algolia
MIT License
88 stars 15 forks source link

Add custom layout configuration #32

Closed xuexb closed 5 years ago

xuexb commented 6 years ago

Hi, hello, my blog is a custom layout parameter like:

title: my-demo
layout: doc
---

content

In the code:

https://github.com/oncletom/hexo-algolia/blob/51224dccf5bccdea25b209a9de892c8092b8f5fc/lib/command.js#L90-L94

Only the page with layout page was selected, which resulted in my page not being found.

Will you be able to use layout as an argument? For example:

algolia:
  layout:
    - page
    - doc

algolia:
  layout:
    - *

thank you very much~

thom4parisot commented 6 years ago

Hello,

I see what you mean. Related to #28 in which there is an interest in indexing only certain properties, I can see we could index content types based on different criterias.

Indexing posts:

algolia
  index:
  - post

Indexing all pages, posts with a given tag and posts with a cover image property (regardless of its content):

algolia
  index:
  - page
  - post: tag=node.js
  - post: cover.image.src
  - post: layout=doc
# equivalent to
  - doc
thom4parisot commented 5 years ago

This feature landed in 922277c7c81495f3e65602ed714009a17b45ef15.