Utilities
Helper functions and utilities included with Scholar.
Last updated: January 25, 2026
Scholar includes utility functions for common documentation tasks.
Documentation utilities
Located in src/utils/docs.ts:
getDocSlug(id: string)
Extracts the URL slug from a content collection entry ID.
sortDocs(docs)
Sorts documentation entries by their order frontmatter field.
getAdjacentDocs(docs, currentSlug)
Returns previous and next documentation pages for pagination.
formatDate(date)
Formats dates in a human-readable English locale string.
SEO utilities
Located in src/utils/seo.ts:
getSEO(options)
Generates title, description, canonical URL, and Open Graph image metadata from site config.
import { getSEO } from '../utils/seo';
const seo = getSEO({
title: 'My Page',
description: 'Page description',
canonical: '/my-page',
});
Animation scripts
Client-side scripts in src/scripts/:
lenis.ts— smooth scroll initializationgsap-init.ts— scroll-triggered reveal animationshero-three.ts— Three.js particle background for hero
These respect prefers-reduced-motion and can be disabled via site config.