Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

981 B
Raw Blame
import { getCollection } from 'astro:content';

import { isRootOnlyPath } from '../config/locales.mjs';

/**
 * Whether a route renders a docs collection page. Its entry id is the page's own for a translation, and the English
 * page's for a locale's fallback route. Other routes, such as the 404 page, release pages and hand-written
 * `StarlightPage`s, carry entries outside the collection.
 */
export const isDocsPage = async (entryId: string) => {
  // Starlight's route entries give the home page the id `''`, which is `index` in the collection.
  const id = entryId || 'index';
  // `getEntry` would log a warning for every page outside the collection.
  return (await getCollection('docs', (doc) => doc.id === id)).length > 0;
};

/** Whether a route exists in every locale, so it can link to its translations: docs pages that are not root-only. */
export const isLocalizablePage = async (entryId: string) =>
  !isRootOnlyPath(`/${entryId}`) && (await isDocsPage(entryId));