Capella Jekyll documentation
Comments and search
Turn on Giscus comments stored in your GitHub Discussions, and learn how Capella's search finds posts without a search service.
Comments
Capella’s comments use Giscus. They live in your GitHub repository’s Discussions, so there’s no database, no ads and nothing for you to host. Readers sign in with GitHub to write a comment. Comments are off by default.
Turn them on
- Put the site in a public GitHub repository and turn on Discussions in its settings.
- Install the Giscus app on the repository.
- Go to giscus.app, enter your repository and pick a Discussions category. It gives you four values.
- Set them in
_config.yml:
capella:
comments:
provider: giscus
repo: your-name/your-repo
repo_id: "R_kgDO..."
category: Comments
category_id: "DIC_kwDO..."
Comments show on posts only, under the author box and related posts. Nothing shows until provider is giscus and repo_id is filled in.
How they behave
- They load on request. A post shows a “Show comments” button. Giscus and its scripts load only when a reader clicks it, so comments never slow the page down.
- They follow the color mode. Giscus opens in dark or light to match the page at the moment of the click.
- They use the site’s language (
langin_config.yml) where Giscus has it. - Each post has its own thread, matched by the post’s address.
To turn comments off on one post, set comments: false in its front matter. The wording around the button comes from _data/strings.yml (comments, comments_note and show_comments).
Search
The Search link in the header and the search box in the sidebar both go to /search/. Search needs no service and no account. It works like this:
- When your site builds, Jekyll writes
search.json, a list with every post’s title, address, date, category, tags, excerpt and the start of its text. - The search page reads that file only when it’s needed: when someone clicks into the box, starts typing, or arrives with a search already in the address.
- It shows posts that contain every word the visitor typed, with the matches marked. A match in the title ranks highest, then tags and category, then the excerpt and text.
- Only the first 60 or so words of each post’s text are searched, plus its title, tags, category and excerpt. Write a good excerpt and use tags, and the right posts are found.
Without JavaScript, the page still loads and points visitors to the tags page and the blog.
The search page is kept out of search engines and the sitemap. To remove search altogether, delete the Search link in _includes/header.html, the search line in _data/sidebar.yml, and search.html and search.json. The 404 page also has a search box, in 404.html.