Build a Manual with Hugo #6: Maintenance — Search Index, Accessibility, Documentation Culture

4 min read

By the time you reach #5, you have docs equipped with multilingual support and versioning. The building stage is now done. Docs aren’t something you make once and finish; they keep growing alongside the product. In this final post we cover the operations that keep those docs alive for the long run.

This series, Build a Manual with Hugo, runs in six parts.

  • #1: From Install to Your First Doc
  • #2: Sidebar and Search — Shaping the Information Architecture
  • #3: Writing Content — Code Blocks, Mermaid, Callouts
  • #4: Deploying to Cloudflare Pages and Connecting a Domain
  • #5: Multilingual Content and Versioning
  • #6: Maintenance — Search Index, Accessibility, Documentation Culture ← this post

This post lays out three things: search that scales, accessibility for everyone, and the culture that keeps docs alive.

Search That Scales — Pagefind #

In #2 we attached Hextra’s built-in search. When the docs grow to hundreds of pages, downloading the entire build-time index at once makes the initial load heavy. The tool you can switch to here is Pagefind.

Pagefind scans Hugo’s public output after the build to create the search index. It splits the index into small chunks and the browser fetches only the fragments it needs for a given search term, on demand, so even with thousands of pages the initial load stays light. It also handles tokenization for languages like Korean smoothly. Just add one line after the build command.

Build a search index with Pagefind
hugo --gc --minify
npx -y pagefind --site public

For the search box, embed the UI that Pagefind provides into your search page.

Attaching the search UI
<link href="/pagefind/pagefind-ui.css" rel="stylesheet">
<script src="/pagefind/pagefind-ui.js"></script>
<div id="search"></div>
<script>
  window.addEventListener('DOMContentLoaded', function () {
    new PagefindUI({ element: '#search' });
  });
</script>

Accessibility for Everyone #

Docs should be readable by as many people as possible. Hextra has good default accessibility, but there are a few spots that break easily in the process of writing and styling.

  • Don’t skip heading levels. Going down one level at a time is what lets a screen reader read the structure correctly.
Keeping the heading hierarchy
# Page title (h1, one per page)
## Major section (h2)
### Minor section (h3)
  • Link text should make sense on its own. Write the destination, like “installation guide,” rather than “click here.”
  • Add alt text to images. Drawing diagrams with Mermaid makes them text, which frees you from this problem.
  • Keep color contrast. When you tweak theme colors, check that the contrast between body text and background exceeds the WCAG AA standard (4.5:1).

The Culture That Keeps Docs Alive #

Even with a good documentation tool, once updates stop, docs quickly become a lie. What long-lived docs have in common isn’t the tool but the habits.

The key is sticking to Docs as Code, which we took as the starting point in #1, all the way through. Keep docs in the same repository as the code, and fix the related docs within the Pull Request that changes a feature. Put “update the docs” into your definition of done, and code and docs drifting apart becomes less common.

On top of that, add a few practical habits: surface each page’s owner and last-modified date so stale pages are easy to spot, check for broken links automatically at the build step, and fix things incrementally rather than putting off a big overhaul. Steady small updates keep docs alive better than one perfect cleanup.

Closing the Series #

Across six posts we built a documentation site with Hugo and Hextra, from start to operations. We installed (#1), shaped the structure with the sidebar and search (#2), filled in the content with code blocks and diagrams (#3), deployed to Cloudflare Pages (#4), added multilingual support and versioning (#5), and finally reached how to maintain it for the long run (#6).

If a blog is a chronological collection of posts, a documentation site is a structured reference. That difference split everything, from tool choice to operational habits. Now I hope you’ll put your team’s docs on top of this flow.

X