Configuration

Customize DocLayer via app.config.ts and its configuration

Understanding Configuration

While DocLayer is designed as a zero-config solution, and our main intention was to build a product that follows the "convention over configuration" principle, we also provide a straightforward way - based on sensible defaults - to customize its appearance and functionality to suit your needs, without diving into the internals.

For this, we use Nuxt’s well-established app.config.ts file, which is intended to store application closest and custom configuration.

app.config.ts

app.config.ts is a relatively new feature, introduced after Nuxt 3, and it aligns closely with the new application structure introduced in the Nuxt 4.

You can read more about app.config.ts in the Nuxt documentation.

To ensure type-safe configuration, we've provided a macro function called defineDoclayerAppConfig. This wraps your App Config with our predefined DocLayer configuration, giving you type suggestions for all DocLayer settings as well as your own custom options, defined via the CustomAppConfig type.

You can treat app.config.ts just like a regular Nuxt application configuration file. Any options related to Nuxt Modules or plugins (such as Nuxt UI) can still be defined within the defineDoclayerAppConfig macro.

/** Custom (internal) App Config */type CustomAppConfig = {  customProperty?: string;};export default defineDoclayerAppConfig<CustomAppConfig>({  customProperty: 'custom value',  dl: {    // here goes DocLayer's configuration  },});

With this setup, you’ll see type suggestions for all DocLayer’s built-in settings, Nuxt's settings, as well as your own custom properties.

AppConfig suggestions - DocLayer.dev
app.config.ts | Config suggestions

Notice that the object passed to defineDoclayerAppConfig is empty by default. This means all default configuration is applied, and you likely don’t need to change anything unless you want to customize application behavior.

Default Configuration

Below you’ll find the full default DocLayer configuration, which you can freely adjust/change to your needs. All preferences are optional and have their sensible defaults. Review the list to learn more about each setting.

API Reference

All DocLayer configuration is available under the dl key accessible from the app.config.ts. Here you can find a full AppConfig Reference.

useAppConfig composable

When building custom components, pages, composables or utility functions the contents of app.config.ts are available throughout your app via Nuxt’s native useAppConfig composable.

<script setup lang="ts">// To get any of your custom config dataconst appConfig = useAppConfig();console.log(appConfig.customProperty);// To get DocLayer-specific config data */const { dl } = useAppConfig();console.log(dl);</script>

dl.adapters

An object containing DocLayer extensibility endpoints (adapters). Currently, this is used only for the Newsletter, which can be connected to the DlNewsletter component that can be used e.g., on the Landing Pages.

To learn how to use pre-built adapters, create one from scratch, or work with DocLayer Adapters in general, read the documentation here.

typedefaultrequired
Adaptersundefinedno

By default, any adapter is connected.

dl.components

An object that allows you to specify global settings for individual components. Configuration options vary by component; visit the relevant component's documentation page for details.

The list below shows which components support global configuration.

NameTypeDocs
DlCodeBlockGo to page

dl.pathMap

An array that lets you map your content paths to special keys (markers) for use with the DlLink component. By default, DocLayer automatically creates an internal JSON file that links each content document path to a unique marker. These markers are registered automatically and can be referenced directly in the DlLink component. You can also define your own custom mappings, giving you full control over the path data, including support for external links.

typedefaultrequired
PathMap[]no

This is how you can define custom mapping:

export default defineDoclayerAppConfig({  // the rest of the config  dl: {    pathMap: [      {        marker: '$custom-path-marker',        url: 'http://somedomain.com/custom/url',        label: 'Custom label',      },    ],  },});
This is how I'm using :link[$custom-path-marker] with custom mapping.

The TypeScript compiler will suggest all predefined markers, both for standard registry strings and for custom object marker values.

Image
TypeScript pathMap suggestions

Overwriting default mapping

You can override automatically generated paths by creating a custom mapping with the same marker as an existing one. In this case, your custom mapping will take priority and be used instead of the default. This is especially useful if you want to use already defined markers but the content path has changed, or you want to use a different label.

dl.transformers

An object containing custom transformers. Currently there are two transformers available:

  • code - allows you to transform code blocks inside the DlCode component before they are rendered. It is currently used to escape selected chunks of code.
  • content - allows you to transform Markdown content both before it is converted to an AST (pre, as Markdown) and after (post) it has been rendered to HTML from the AST. These transformations are applied to every dynamic page.
typedefaultrequired
Transformers

see below

no

Below, transformers provided by default.

import { utilTransformers } from '@vuehouse/dl/exports';export default defineDoclayerAppConfig({  // the rest of the config  dl: {    transformers: {      code: (code) => utilTransformers.transformCode(code),      content: {        pre: (code) => utilTransformers.transformMarkdown(code),        post: (code) => utilTransformers.transformAST(code),      },    },  },});

Caution when defining custom transformers

Please note that transformer functions utilize the pre-built, internal set of utilities. Also, these transformers are applied globally across all content. If you use a dedicated method to transform parts of your code or content, make sure to reuse the results of the existing transformers when defining your custom ones. You can do this as follows:

import { initialAppConfig: config } from '#imports';export default defineDoclayerAppConfig({  // the rest of the config  dl: {    transformers: {      code: (code) => {        const defaultTransformedCode = config.dl.transformers.code(code);        // your custom transformation logic        return defaultTransformedCode.replace(/pattern/g, 'replacement');      },      content: {        /* do the same for the content transformer */      },    },  },});

dl.ui

This object contains layout-related behavioral configuration. If you want to adjust DocLayer’s layout preferences, this is the section you’ll likely want to modify.

Theming

Visually, DocLayer is themed using CSS Variables and dedicated Tailwind utility classes. More about theming setup you can read here.

All items within this object are predefined and optional. You only need to define them in your app.config.ts file if you want to change or extend certain options.

dl.ui.colorMode

Sets the preferred color mode for the application.

DocLayer uses Nuxt’s Color Mode Module to control the application color mode. More about the internal module usage you can read here.

typedefaultrequired
'dark' | 'light' | 'system'systemno

dl.ui.header

Controls whether the layout Header is displayed on the Landing Page.

typedefaultrequired
booleantrueno

dl.ui.headerLogoPath

The path to the layout Header logo. By default, the logo is placed in the /public directory, so it’s accessible directly from the base application URL (e.g., your.domain/logo.webp). There’s no need to specify the path if you use the default.

To keep the default, simply add your logo file (logo.webp) to the /public directory.

To use different logos for light and dark modes, provide an object with light and dark properties, using the same image path rules for each. You can also add an optional fallback property, which will be used when the color mode is set to system or is not yet determined. If no fallback is provided and color mode is not resolved yet, the logo stays hidden.

Image optimization

Images in the /public directory are always optimized by the Nuxt Image Module. Images in /app/assets are not, as they’re handled by the internal bundler (Vite or Webpack).

Everything you need to know about image optimization you can read here.

typedefaultrequired
type DocLayerConfig = {  // rest of the AppConfig interface  headerLogoPath:    | string    | {        light: string;        dark: string;        fallback?: string;      };};
'/logo.webp'no

dl.ui.headerLogoWidth

Controls the width of the layout Header logo, in rem units.

DocLayer uses only rem units for sizing. More about in-CSS sizing and layout scaling setup you can read here.

typedefaultrequired
'${string}rem' | 'auto''9rem'no

dl.ui.headerLogoHeight

Controls the height of the layout Header logo, in rem units.

typedefaultrequired
'${string}rem' | 'auto''auto'no

dl.ui.headerIconSize

Sets the size of the right-side Header icons menu, in rem units.

typedefaultrequired
'${string}rem''1.5rem'no

dl.ui.headerIconsReverse

If set, reverses the order of the right-side Header icons menu.

typedefaultrequired
booleanundefinedno

dl.ui.headerNavReverse

If set, reverses the order of the Header navigation.

typedefaultrequired
booleanundefinedno

dl.ui.footerNavReverse

If set, reverses the order of the right-side footer navigation.

typedefaultrequired
booleanundefinedno

dl.ui.navPreview

Controls whether to show the section preview tooltip in the navigation.

typedefaultrequired
booleantrueno

dl.ui.truncatePageNavigationTitle

Controls whether to truncate the page navigation (bottom) title.

typedefaultrequired
booleantrueno

dl.ui.truncatePageNavigationDescription

Controls whether to truncate the page navigation (bottom) description.

typedefaultrequired
booleantrueno

dl.headerIcons

An object with an array of links for the application's right-side Header icons menu.

typedefaultrequired
{ links: Exclude<NavLink, '_overwrite'>; }undefinedno

To add new icons to the right-side Header menu, note that the Search and Color Mode icons are always present. You can add your own custom icons (e.g., for a GitHub, Discord, etc.) as follows:

export default defineDoclayerAppConfig({  // the rest of the config  dl: {    headerIcons: {      links: [        {          url: '/docs/custom-url',          // label will be used as an icon tooltip content          label: 'Custom Link',          icon: 'icon-name',        },      ],    },  },});

By default we use Bootstrap icon set for the header icons, so any prefix is not required. However, you can use any other icon set by adding the prefix to the icon name. For example: icon: 'vscode-icons:icon-name' or icon: 'lucide:icon-name'.

dl.headerNav

An object with an array of links for the application's Header navigation.

typedefaultrequired
{ links: NavLinks }

see below

no
export default defineDoclayerAppConfig({  // the rest of the config  dl: {    headerNav: {      links: [        // entrypoint to blog        {          label: 'Blog',          url: '/blog',        },        // entrypoint to docs        {          label: 'Docs',          url: '/docs/getting-started',        },      ],    },  },});

To define Header navigation, you have three options:

  1. Leave it as is - if your content file names and locations match the URLs above (e.g., /docs/getting-started/introduction.md).
  2. Define new, custom links - they will be merged with the default navigation.
    export default defineDoclayerAppConfig({  // the rest of the config  dl: {    headerNav: {      links: [        {          url: '/docs/custom-url',          label: 'Custom Link',        },      ],    },  },});

    Be aware that new custom links will be added at the beginning of the merged array. If you want them in reversed order, set dl.ui.headerNavReversed to true.

  3. Overwrite default navigation - add the special _overwrite string at the beginning of your custom links array. Define new links.
    export default defineDoclayerAppConfig({  // the rest of the config  dl: {    headerNav: {      links: [        '_overwrite',        {          url: '/docs/custom-url',          label: 'Custom Link',        },      ],    },  },});

dl.footerNav

An object with an array of links for the application's Footer navigation. The setup is identical to dl.headerNav, so refer to the section above.

typedefaultrequired
{ links: NavLinks }undefinedno

dl.inDocData

An object containing custom data that can be accessed in your Markdown (.md) files. This might be really handy if you want to reuse certain data across your content. Any property you add to this object can be accessed using the special data binding $doc handler.

typedefaultrequired
Record<string, Primitive | PrimitiveRecord>nono

To keep this object manageable, it's restricted by the type to define only one nested object and use only basic primitives as values.

This is how you can set and get (use) your data:

export default defineDoclayerAppConfig({  // the rest of the config  dl: {    inDocData: {      customProperty: 'Hello World',    },  },});
This is my custom content: {{ $doc.customProperty }}!<!-- results in: This is my custom content: Hello World! -->

dl.meta

An object containing global SEO metadata. It's used to populate data to SEO meta tags throughout your application.

DocLayer handles SEO metadata using the unhead and SchemaOrg Modules, both integrated via the internal useDynamicHead composable. You can learn more about this setup here.

typedefaultrequired
Record<'title' | 'description' | 'keywords' | 'author' | 'robots' | 'tag' | 'locale' | 'og:${string}', string>

see below

no
export default defineDoclayerAppConfig({  // the rest of the config  dl: {    meta: {      tag: process.env.DL_META_TAG, // 'doclayer',      title: process.env.DL_META_TITLE, // 'DocLayer.dev | The Smart Content Framework powered by Nuxt'      description: process.env.DL_META_DESCRIPTION, // 'Write anything in markdown, DocLayer handles the rest. Stunningly.'      keywords: process.env.DL_META_KEYWORDS, // 'vue, nuxt, docs, documentation, content, module, framework, template, typescript, javascript'      author: process.env.DL_META_AUTHOR, // 'vue.house'      robots: process.env.DL_META_ROBOTS, // 'noindex, nofollow'    },  },});

To define SEO metadata, you have two options:

  1. Use environment variables - these will take precedence over default values.
    DL_META_TAG=DL_META_DOMAIN=DL_META_TITLE=DL_META_DESCRIPTION=DL_META_KEYWORDS=DL_META_AUTHOR=DL_META_ROBOTS=
  2. Overwrite the meta object in app.config.ts.

By default, DocLayer automatically handles several og (Open Graph) tags for you. For example, og:title and og:description are set based on the values you provide in meta.title and meta.description. Tags like og:locale, og:type, and og:url are also managed.

If you want to add more Open Graph tags globally, or override the default values, simply add or update properties in the meta object. For example:

export default defineDoclayerAppConfig({  // the rest of the config  dl: {    meta: {      // the rest of the meta objects      'og:title': 'Your custom title',      'og:image': '/path/to/your/image/file',    },  },});

On how to define and handle metadata locally you can read here.

dl.schemaOrg

This object contains global values that will be propagated to the Schema.org graph.

typedefaultrequired
SchemaOrgundefinedno

More about local Schema.org metadata, you can read here.

dl.llms

An object containing data used to generate the llms.txt static file. Note that this file is only available at build time and will be included in your final built static app.

DocLayer uses the Nuxt LLMs Module, which implements the llms.txt file concept. This is paired with a dedicated internal plugin that enables you to control the data from app.config.ts. The plugin also collects content data to generate llms.txt sections. More about this setup, you can read here.

typedefaultrequired
LLMOptions

see below

no
export default defineDoclayerAppConfig({  // the rest of the config  dl: {    llms: {      domain: process.env.DL_META_DOMAIN, // 'https://doclayer.dev'      title: process.env.DL_LLMS_TITLE || process.env.DL_META_TITLE, // 'DocLayer.dev | The Smart Content Framework powered by Nuxt'      description: process.env.DL_LLMS_DESCRIPTION || process.env.DL_META_DESCRIPTION, // 'Write anything in markdown, DocLayer handles the rest. Stunningly.'      sections: [],    },  },});

To define LLMs data, follow the same rules as for SEO metadata. Here are the environment variables you can use:

DL_LLMS_TITLE=DL_LLMS_DESCRIPTION=