zhouhao / Hexo-Tipue-Search-Json

hexo plugin that generates JSON file for tipue search
MIT License
2 stars 1 forks source link

Add featured image to search? #2

Closed ntot closed 7 years ago

ntot commented 7 years ago

Fantastic and simple plug in, thank you so much for this! :) I wanted to know if it possible to add an image to the search? Where can I edit what is displayed in the results?

Thanks again

zhouhao commented 7 years ago

Thx! To edit the output search result, you can start from here https://github.com/zhouhao/hexo-Web-Source/blob/master/themes/cyanstyle/source/tipuesearch/tipuesearch.js#L372

ntot commented 7 years ago

Thank you, I managed to write the image path with Json but I keep getting undefined when I try to add the image path to the Tipue search, I am not as good with JS as you. Any suggestions?

zhouhao commented 7 years ago

Can I have a look of your code? I can try to help.

ntot commented 7 years ago

Appreciate the help, I am still learning JS :) All I want is an image next to the title, since I don't want tags I used the tags tag and replaced it with image, in my front matter I have a tag called avatar

The path of the image will always be the page slug so:

https://gist.github.com/ntot/8fd9cf73301e010be65dd07f9fb45ccc

I know the code is wrong but not sure how to fix. Thanks again.

zhouhao commented 7 years ago

Sorry to get back to you this late. Pretty busy this weekend. BTW: could you give me a screenshot/design for how to display the image? As I could not find any <img> tag in you code.

No worries, I am also learning JS now

ntot commented 7 years ago

Hi, thanks again, really appreciate it. Here is a sample of what I wanted to do: https://ibb.co/bWveqk All I need is to add an image next to the name, in my front matter I have a custom field called avatar and it´s also in my json file just can´t output it. Thanks again-

zhouhao commented 7 years ago

Sorry, I just find I have not implemented the drop-down feature. And bad news is that I cannot have that in a short time. 🤦‍♂️

zhouhao commented 7 years ago

But I could have a try when I have time, but no guarantee when I will implement it

mrttl commented 7 years ago

HI, oh no, no drop down, it was just to show when you type a name it shows up, sorry it was my mistake, I have the search working it was just the image that I can't get working :-/

zhouhao commented 7 years ago

Do you mean something as this: https://twitter.github.io/typeahead.js/?

mrttl commented 7 years ago

Ahh yes! :) An image next to the name just like that, I don't need anything else...

zhouhao commented 7 years ago

Yeah, that is also what I want eventually(Not displaying result in a separate page). 🤒 Would have a try soon

mrttl commented 7 years ago

My friend no problems! You have created an amazing amazing plugin! I will use it as it is and maybe I will find out how to do it and do a PR. Thank you for your hard work and talent!

zhouhao commented 7 years ago

Hello @mrttl , I did some work for hexo-theme-apollo-plus, and I find this ticket is better to be done with a theme. For a single plugin, it is not easy to make it compatible with most hexo themes.

I don't know what is your idea, but would like to know if you have any suggestion.