Giter Site home page Giter Site logo

Comments (4)

matcornic avatar matcornic commented on August 25, 2024

Hey @fgiorlando

Go check this https://matcornic.github.io/hugo-learn-doc/basics/configuration/ and this https://matcornic.github.io/hugo-learn-doc/basics/installation/

[params]
  # Prefix URL to edit current page. Useful to give opportunity to people to create merge request for your doc.
  # See the config.toml file from this documentation site to have an example.
  editURL = ""
  # Author of the site, will be used in meta information
  author = ""
  # Description of the site, will be used in meta information
  description = ""
  # Shows a checkmark for visited pages on the menu. Default to false
  showVisitedLinks = false
  # Automatically generates prev and next arrows
  autoNav = false
  # Activate search. Don't forget to generate the JSON index file (go check get started page)
  search = false

Basically, you have to:

  1. Activate search by setting search = true parameter, but inside a params "section" (Ex: https://github.com/matcornic/hugo-learn-doc/blob/master/config.toml#L7)
  2. Generate json index. Instead of using grunt, you could use hugo-lunr project directly : https://matcornic.github.io/hugo-learn-doc/basics/installation/#enable-search-functionality (Ex: index NPM script in https://github.com/matcornic/hugo-learn-doc/blob/master/package.json)

You should find everything you need on the documentation. And if you need a real life working example, the repo is here.

from hugo-theme-learn.

fgiorlando avatar fgiorlando commented on August 25, 2024

Thanks for the tips, I have now put the search config in a [params] section and the search box appears.
I am a little new to using node so I have what may be an obvious question: when I install hugo-lunr with npm install lunr-hugo, it installs fine. However, I can't run lunr-hugo as I get the error: -bash: lunr-hugo: command not found.
Do I have to set some path settings?

from hugo-theme-learn.

matcornic avatar matcornic commented on August 25, 2024

npm install -g lunr-hugo, and it should work.

from hugo-theme-learn.

fgiorlando avatar fgiorlando commented on August 25, 2024

thanks @matcornic, that fixed it!
Sorry I know it was pretty obvious, I'm a bit of a node nube!
I'm impressed by how fast hugo is, I had previously built exactly the same site with grav and it's so much faster now

from hugo-theme-learn.

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.