Configuration

The project configuration is simple and centralized in the explainer.config.ts file.

This file uses the defineExplainerConfig function to define all the configurations for the site. Here is an overview of the different configuration sections available:

export default defineExplainerConfig({
  meta: { ... },
  urls: { ... },
  docs: { ... },
  blog: { ... },
  navbar: [ ... ]
})

Metadata

The meta section defines the main metadata for the site:

meta: {
  title: 'Explainer',
  description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
  thumbnail: 'https://placehold.co/1200x630',
}
PropertyTypeDescription
titlestringMain title of the site, displayed in the browser tabs
descriptionstringShort description of the site used in SEO metadata
thumbnailstringDefault thumbnail URL for social media sharing

External URLs (urls)

The urls section contains the external links to the project resources:

urls: {
  github: 'https://github.com/LeadcodeDev/explainer',
}
PropertyTypeDescription
githubstringURL of the project GitHub repository

Documentation (docs)

The docs section configures the different documentation sections. Each key defines a section with its properties :

docs: {
  framework: {
    icon: CuboidIcon,
    label: 'Framework',
    href: '/docs/framework/getting-started',
    baseUrl: '/docs/framework',
  },
  syntax: {
    icon: PencilLineIcon,
    label: 'Syntax',
    href: '/docs/syntax/texts',
    baseUrl: '/docs/syntax',
  },
}

For each documentation section :

PropertyTypeDescription
iconComponentLucide icon component for representing the section
labelstringDisplayed name of the section in the interface
hrefstringComplete URL to the main page of the section
baseUrlstringBase URL for all pages in this section

Blog (blog)

The blog section configures the blog settings:

blog: {
  defaults: {
    thumbnail: 'https://placehold.co/1200x630',
  },
  authors: {
    leadcode_dev: {
      name: 'LeadcodeDev',
      avatar: 'https://avatars.githubusercontent.com/u/8946317?v=4',
      href: 'https://github.com/LeadcodeDev',
    },
  }
}
PropertyTypeDescription
defaults.thumbnailstringDefault thumbnail for articles without specified image
authorsobjectDefinition of authors who can publish on the blog

For each author (authors.{id}):

PropertyTypeDescription
namestringFull name of the author
avatarstringURL of the author’s avatar
hrefstringLink to the author’s profile

The navbar section defines the structure of the navigation bar as an array of elements:

navbar: [
  {
    label: 'Docs',
    items: [
      {
        label: 'Framework',
        description: 'Discover Explainer framework guidelines and usages.',
        href: '/docs/framework/getting-started',
      },
      // ...autres items
    ],
  },
  {
    label: 'API',
    href: '/api',
  },
  // ...autres éléments de navigation
]

Each navigation element can have the following properties:

PropertyTypeDescription
labelstringText displayed in the navigation
hrefstring(Optional) Direct link to a page
itemsarray(Optional) Dropdown submenu

For each dropdown item (items):

PropertyTypeDescription
labelstringName of the item
descriptionstringDescription text of the section
hrefstringLink to the corresponding page

Complete example

Here is a complete example of configuration:

import { defineExplainerConfig } from '@/utils'
import { CuboidIcon, PencilLineIcon } from 'lucide-react'

export default defineExplainerConfig({
  meta: {
    title: 'My Explainer',
    description: 'Complete documentation of my project',
    thumbnail: 'https://my-site.com/thumbnail.png',
  },
  urls: {
    github: 'https://github.com/my-account/my-project',
  },
  docs: {
    guide: {
      icon: CuboidIcon,
      label: 'Guide',
      href: '/docs/guide/introduction',
      baseUrl: '/docs/guide',
    },
    api: {
      icon: PencilLineIcon,
      label: 'API',
      href: '/docs/api/overview',
      baseUrl: '/docs/api',
    },
  },
  blog: {
    defaults: {
      thumbnail: 'https://my-site.com/blog-default.png',
    },
    authors: {
      john_doe: {
        name: 'John Doe',
        avatar: 'https://my-site.com/avatars/john.png',
        href: 'https://github.com/johndoe',
      },
    }
  },
  navbar: [
    {
      label: 'Documentation',
      items: [
        {
          label: 'Guide',
          description: 'Complete project guide',
          href: '/docs/guide/introduction',
        },
        {
          label: 'API',
          description: 'Documentation of the API',
          href: '/docs/api/overview',
        },
      ],
    },
    {
      label: 'Blog',
      href: '/blog',
    },
  ]
})