@thimiraonline, you already are since you use the latest version of Ghost Easybar
[1.3.1] - 2020-05-23
- Ability to set inputId to false when no input field is needed.
Thank you for making this, it works perfectly and it is blazing fast. My website has not had search ever working so smoothly and so functionally. Before it wouldn’t search by content or tag, and if you typed like ten characters it would crash. Now it’s seamless!
@gmfmi Thanks for sharing your work! I’ve checked it out and replaced our previous implementation of Ghosthunter. My reason for searching is that it was more easily modified to also search for tags, author, and post body. Ghosthunter allowed searching of post body out of the box but it was too slow (at least with our content). SearchinGhost allows searching of post body but quickly.
If I can provide one piece of feedback, it’d be nice if we could skip
childOutputType and append the results of the template function without getting wrapped in an element. If that’s already a possibility and I misunderstood the docs sorry for my mistake.
Great job, pretty happy so far!
Thank you @sashinexists. Happy to read that I took a look at your blog and I have a few tips to make improvements (you will receive that in a private message).
Hi @ijongkim, thanks for the feedback! For now, it is not possible to skip
childOutputType. Could you give me more context about it, I don’t understand why would you not use a wrapper element? You want to put all the results next to each other without any structure? For what particuliar reason would you do that?
I don’t understand why would you not use a wrapper element? You want to put all the results next to each other without any structure? For what particuliar reason would you do that?
It’s simply not necessary to have individually wrapped items, that’s all. Here’s a screenshot of the DOM structure:
The results render inside
div#results so the additional
li tag is unnecessary. It’s not a deal breaker for me as the additional
li tag doesn’t break anything but it might break things for others and may also make implementation into an existing site easier to be able to skip
It would also be a fairly easy fix as well to allow
null value to indicate skipping the rendering of a wrapper element. Looking at your current source code though, I can see why the wrapping element is a requirement.
One solution is to check for
childOutputType inside of
display() and calling a different function if
childOutputType === null. This alternate function would take the returned value from
this.config.template and append it to the output element using
Happy to submit a PR if that’s easier.
OK, I got the point. In your case, the anchors are also the wrapping elements.
If you want to, I will accept a PR with pleasure. Also, take into account that:
- do not forget the empty template case
- the config value to disable childElement is ‘false’
If you need more guide lines, send me a private message or create a GitHub issue. Happy coding!
In any case, I will release a new version in 2-3 days with that update included.
I’ve created an issue and proposed two approaches. One would be appending the strings provided by the
emptyTemplate functions using
insertAdjacentHTML as discussed above.
The other is to expect the
emptyTemplate to return proper Elements and those could be inserted using
The benefit of the first approach is that users won’t have to refactor their
emptyTemplate functions to take advantage of this option.
The benefit of the second approach is that it requires only a single check in
evaluateTemplate() and the rest of your code in
display() can remain as is.