Coder Social home page Coder Social logo

Add search to the website about website HOT 7 OPEN

choojs avatar choojs commented on July 20, 2024
Add search to the website

from website.

Comments (7)

yoshuawuyts avatar yoshuawuyts commented on July 20, 2024 2

Oh this looks pretty excellent!

  1. I was thinking perhaps something in the top nav bar? Getting functionality in first, and styling it later might be the most efficient way to approach it.
  2. Uehhh, see 1?
  3. Probably all the text in the docs?

I'm pretty excited about this! - it probably doesn't work offline, right? - but then.. that probably doesn't matter too much?

from website.

s-pace avatar s-pace commented on July 20, 2024 2

👋 @yoshuawuyts ,

Perfect! You can update it later on

Congratulations, your search is now ready!
I've successfully configured the underlying crawler and it will now run every 24h.

You're now a few steps away from having it working on your website:

  • Copy the following CSS/JS snippets and add them to your page
<!-- at the end of the HEAD -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />
<!-- at the end of the BODY -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
<script type="text/javascript"> docsearch({
  apiKey: '87f0d96cbd5365099c978ede57cc22f5',
  indexName: 'choo',
  inputSelector: '### REPLACE ME ####',
  debug: false // Set debug to true if you want to inspect the dropdown
});
</script>
  • Add a search input if you don't have any yet, and update the inputSelector value in the code snippet to a CSS selector that targets your input field.
  • Optionally customize the look and feel by following the DocSearch documentation
  • You can also check your configuration in the github repo. Feel free to open pull requests!

Feel free to get back to us if you have any issues or questions regarding the integration.
We'd also be happy to get your feedback and thoughts about DocSearch - so we can continue to improve it.

Have a nice day :)

NB: In your email
NB2: Berlin ist wunderbar

from website.

s-pace avatar s-pace commented on July 20, 2024 1

👋 Happy to help @yoshuawuyts,
Please let us know what you would like to have and once it is done, just submit one of your link her
I will provide you the JS snippet to integrate within your website.
TY @Haroenv

from website.

Haroenv avatar Haroenv commented on July 20, 2024

Nope, it's doing a request per character, there's not really a way to make a great search offline available unless you'd have a whole search engine on your computer.

What urls are that then, https://choo.io/reference/*, https://handbook.choo.io too?

from website.

yoshuawuyts avatar yoshuawuyts commented on July 20, 2024

@Haroenv yeah, /reference should be enough. Currently moving to /docs as per #59 - but it should already be indexable.

Was thinking we move handbook.choo.io to choo.io/guides/your-first-choo-app or something, so no need to index it! 😁

from website.

yoshuawuyts avatar yoshuawuyts commented on July 20, 2024

@s-pace thanks heaps!

@Haroenv you willing to pick it back up from here? 😁

from website.

Haroenv avatar Haroenv commented on July 20, 2024

Seems like something went wrong with Zepto (a dependency of DocSearch), where it can't list data of input events for some reason. I don't have the bandwidth currently to make a new version of DocSearch which doesn't depend on Zepto unfortunately (there's a PR for that issue, but not much noise madrobby/zepto#1319).

I also am not too sure how to initialise docsearch after I made the dom node, should I render a script element?

docsearch({
  apiKey: '87f0d96cbd5365099c978ede57cc22f5',
  indexName: 'choo',
  inputSelector: '#docsearch',
});

See my quick work at Haroenv@479d567

For the styling I guess I'll need to do sheetify with the css from node_modules

from website.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.