Skip to content

Latest commit

 

History

History
148 lines (112 loc) · 4.69 KB

1.content.md

File metadata and controls

148 lines (112 loc) · 4.69 KB
navigation
title
Content

Writing content for the docs

Once you've set up your documentation, you may immediately start writing markdown inside the content/ directory.

---
category: 'Getting started'
---

# Introduction

> Empower your Nuxt application with this awesome module.

Introducing my awesome Nuxt module!

::alert type: info

Checkout Nuxt Content documentation on writing markdown content. ::

Front-matter

Every markdown file should define properties in its front-matter in order to work properly.

Key Type Description
title String Title of the page (will also be injected in metas)
description String Description of the page, will be added below the title and injected into the metas
navigation false | Object If set to false, the page will not display in Docus navigation menus and Next/Prev links
navigation.title String If set, overrides the title that will be displayed in navigation menus
navigation.nested Boolean If set to false, the nested pages will not display in Docus navigation menus
navigation.slot String Mark the page to show in specific menu
navigation.exclusive Boolean If set to true, other pages will not show in the left menu when user visiting the page or its nested pages.
version Float Alert users that the page is new with a badge. Once the page is seen, the version is stored in localStorage and the badge won't be shown again until the version is incremented
fullscreen Boolean Expands the page content and hides the table of contents
badge String Adds a badge next to the page title
position Number Position of the page within the category. By default we use the filename prefix POSITION., example: 1.first-page.md
draft Boolean Mark the page as draft (and only display it in development mode). By default we use the filename suffix .draft, example: 3.my-draft-page.draft.md
head Object Add the HTML Head tags for the current page. The structure of head property is same as Nuxt head method but in YAML syntax. To know the list of options you can give to head, take a look at vue-meta documentation
toc false | object If set to false, it will disable the table of contents generation.
toc.title String If set, overrides the title of table of contents section.
toc.depth Number Determine the depth of generated TOC. Default value is 2, which mean only detect h2 and h3 tags.

The title and description are automatically filed from the Markdown content:

# Title of the page

> Description of the page

You can overwrite them using the front-matter:

---
title: Overwritten title
description: Overwritten description
---

# Title of the page

> Description of the page

Locales

The first level of directories in the content/ folder are the locales used with nuxt-i18n as defined in your nuxt.config.js.

If no en directory is specified, all the files inside content/ will be considered as English:

content/
  1.index.md
  2.about.md
  setting.json

You can override the locales in your nuxt.config.js:

import { withDocus } from 'docus'

export default withDocus({
  i18n: {
    locales: () => [{
      code: 'en',
      iso: 'en-US',
      file: 'en-US.js',
      name: 'English'
    }, {
      code: 'fr',
      iso: 'fr-FR',
      file: 'fr-FR.js',
      name: 'Français'
    }]
  }
})

Then you'll need to use this directory structure:

content/
  en/
    1.index.md
    2.about.md
  fr/
    1.index.md
    2.about.md
  setting.json

::alert{type="info"} As explained in the Nuxt config section, we use defu.arrayFn to merge your config. You can override the i18n.locales array by using a function, or you can pass an array to concat with the default one (which only includes the en locale). ::

Routing

Each markdown page in the content/ directory will become a page and will be listed in the left navigation.

You can also put your markdown files in subdirectories to generate sub-routes.

Example

::code-group

content/
  examples/
    basic-usage.md
  setup.md
/examples/basic-usage
/setup

::

You can take a look at our docs content folder to see an example