import groupData from './tool-groups.json'; /** * How the tools are grouped, and the three things that fall out of it: * breadcrumbs, the category pages, and the "related tools" links under each * tool (after the tool's families in related-tools/tool-families.json, which * pick its closest relatives across categories - see related-links.ts). * * Why one file for all three: they are the same claim about the site made in * three places, and when a tool moved category by hand the breadcrumb, the * category listing and the cross-links used to disagree with each other. The * nav dropdown is built from it too (MENU_GROUPS in toolkit-menu.ts), since * 2 Nov 2026: each group's top six tools and a link to its category page. * * A tool with no group is legitimate: /bookmarks does not belong under any of * these headings, and forcing it into one would put a misleading breadcrumb * on the page. It simply gets a two-level trail. * * The menu itself is built in toolkit-menu.ts, which also needs the SEO data (seo-runtime.json) * (to count what each category page lists) - and seo.types.ts imports this * file, so building it here would be an import cycle. */ export interface ToolGroup { /** Route path of the category page, e.g. 'document-tools'. */ slug: string; /** Label as it appears in the nav dropdown. */ name: string; /**

of the category page. The nav label is too terse to be a heading. */ heading: string; /** One sentence of intro copy for the category page. */ blurb: string; /** Emoji shown on the home page's tile and list heading. */ icon: string; /** A few words for the home page's tile. */ tagline: string; /** Route paths of the tools in this group, in the order they are listed. */ tools: string[]; /** * Tools whose own group is another one but which belong here too (Text to * Speech under Text as well as Audio). Listed after the group's own tools on * the home page and the category page; their breadcrumb stays with their group. */ also?: string[]; } /** The Toolkits menu's own data (built into the menu by toolkit-menu.ts). */ export interface MenuData { hidden: string[]; labels: Record; /** A menu label's language, when it is not English (the Italian and German e-invoice pages). */ lang?: Record; } export const TOOL_GROUPS: ToolGroup[] = (groupData as unknown as { groups: ToolGroup[] }).groups; export const MENU_DATA = (groupData as unknown as { menu: MenuData }).menu; /** How many tools the site has, each counted once: the home page and Hire me both say it. */ export const TOOL_COUNT = new Set(TOOL_GROUPS.flatMap((g) => g.tools)).size; /** Route path -> the group it belongs to. Built once. */ const GROUP_BY_TOOL = new Map( TOOL_GROUPS.flatMap((g) => g.tools.map((t) => [t, g] as const)), ); /** The group a tool belongs to, or undefined if it is not in one. */ export function groupForTool(key: string): ToolGroup | undefined { return GROUP_BY_TOOL.get(key); } /** The category page for a slug, or undefined. */ export function groupBySlug(slug: string): ToolGroup | undefined { return TOOL_GROUPS.find((g) => g.slug === slug); } /** True if the key is one of the category pages. */ export function isGroupSlug(key: string): boolean { return TOOL_GROUPS.some((g) => g.slug === key); }