Metadata is a crucial part of any application, covering information like page titles, descriptions, keywords, and more, including SEO-related data. Managing metadata effectively helps promote your product, improve discoverability, and enhance how your website or documentation appears in search results and social platforms. DocLayer provides comprehensive support for metadata management, giving you flexibility of customization you need.
This guide explains how to manage metadata effectively. Be aware that some portions of the data are resolved automatically and distributed wisely to avoid interpretation conflicts or unnecessary overwrites.
There are two main ways to manage metadata in your application:
Let's explore both to see how you can achieve the most effective setup.
Global metadata
The primary place to define your metadata is the app.config.ts file. Inside its meta property, you can set the global metadata for your application. This means every page will automatically inherit these setting - such as page title, description, keywords, and more. For more flexibility, you can also use environment variables.
More on how to define and configure global metadata you can read here.
Schema.org
As you may have noticed, DocLayer uses the Nuxt Schema.org Module to manage the Schema.org graph. This means that some schema data is automatically generated and handled for you (remaining unchanged), while other parts can be customized either globally or on a per-page basis.
By default two objects for schema.org graph will be generated. The first of them is a global entry, automatically defined for the entire application. Its @type is set to WebSite, which is the default for the global schema graph representing your app. The name field is populated from your app name in the package.json file, while the url is taken from the site property in your nuxt.config.ts file. To easily manage that value, you can set the DL_META_DOMAIN environment variable to update it as needed.
The second object is always responsible for defining the graph entry for a specific page and will be of type WebPage. The name and description values are automatically generated based on your page's metadata. The inLanguage and publisher values are inherited from the global setup defined in your app.config.ts file. The rest of the pregenerated data should not be changed. If you need to customize any of this per page, you can do so using the local setup, which is explained below.
Local metadata (page-based)
DocLayer also allows you to customize metadata for individual content pages. You can do this by adding metadata in the Frontmatter section of each page. To avoid conflicts with the default Nuxt Content setup and the native seo data, DocLayer introduces two additional objects: _seo and _schemaOrg. These objects let you clearly separate and customize SEO and Schema.org data for each page.
Defining your metadata correctly in the frontmatter is essential. Keep in mind that different blocks may be interpreted in specific ways, so clarity is important. Below, you'll find examples of how to set up SEO and Schema.org data. As a general rule, refer to the content schema used for your collections data model to ensure consistency.
Content schema objects are flat and do not contain nested structures, making it straightforward to define. In your content .md (Markdown) file, use Frontmatter with dedicated _seo keys, like this:
And the _schemaOrg keys as follow:
Remember that other elements are distributed globally, and there's no need to define them for each page separately.
