Design System Publisher Configuration
Configuration Options
Environment variables override the JSON property configuration. The website needs to be rebuilt — or restarted in development mode — in order for changes to the configuration variables to take effect.
All path options are relative to the content project folder.
| ENV Variable JSON Property |
Description | Default Value |
|---|---|---|
| Path to configuration JSON files. |
|
| Path to the AsciiDoc articles. |
|
| Path to the dynamically imported custom element examples. |
|
| The site title. Used as the main prefix in the page |
|
| The root URL of the site (i.e., the domain without a path). For example, |
|
| The root path where the website is hosted. For example, if you deploy the site to |
|
| The host name of the Vaadin project. Used for request proxying. |
|
| URL prefix from which JavaScript examples are included. |
|
| Prefix used for Vaadin Fusion endpoints. Replaces effectively only global |
|
| An absolute URL to a JSON file that defines the available versions of the documentation. See example later on this page. |
|
| A JSON object defining the available documentation versions. See example later on this page. |
|
N/A | Links each page’s JSON-LD structured data to your own entities. See Structured Data. |
|
| If |
|
You can prefix the environment variable names with DOCS_ (e.g., DOCS_TITLE) if you need to avoid conflicts with other systems that use the same variable names. The VERSIONS variable is an exception, as it expects a JSON value, and providing that as a string through the command line would be verbose. For example:
Source code
versions.json
versions.json[
{
"title": "Vaadin 23",
"shortTitle": "V23",
"url": "/docs/latest",
"canonicalUrl": "/docs/latest"
},
{
"title": "Vaadin 22",
"shortTitle": "V22",
"url": "/docs/v22"
},
]The title value is shown in the version drop-down, and the shortTitle value, if provided, is shown as the drop-down button value when that version is selected.
The canonicalUrl value, if provided, is the base of the canonical URL of each page of that version. It’s relative to siteUrl, unless it’s an absolute URL.
Structured Data
An article page gets JSON-LD structured data in its <head> when the page has a canonical URL. The canonical URL comes from the canonicalUrl of the version, and from siteUrl when that value is relative. The data contains:
-
the article, with its title, description, canonical URL and last modified date
-
the breadcrumb trail of the page
The last modified date comes from the Git history of the article. Build from a full clone of the content repository: in a shallow clone, every article gets the date of the latest commit.
Use the structuredData property to link the pages to the entities of your own website:
Source code
default.json
default.json{
"structuredData": {
"website": {
"@id": "https://example.com/docs/#website",
"name": "Example Docs",
"isPartOf": { "@id": "https://example.com/#website" },
"publisher": { "@id": "https://example.com/#organization" }
},
"about": {
"/": "https://example.com/#software",
"/other-product": "https://example.com/other-product#software"
}
}
}website is a JSON-LD WebSite node that’s added to each page as is. Each article is marked as part of it, and its publisher is also the publisher of each article.
about maps a path, without the path prefix, to the @id of the entity that the pages under that path are about. The longest matching path is used, so "/" applies to all other pages.
Configuration JSON File
The configuration options with a JSON property can be overridden with a configuration file. The default configuration is the following:
Source code
default.json
default.json{
"articlesPath": "articles",
"themePath": "dspublisher/theme",
"examplesImportPath": "frontend/demo",
"examplesIncludeUrlPrefix": "/vaadin/web-component/",
"vaadinConnectPrefix": "/connect",
"proxyVaadinHostname": "localhost",
"pathPrefix": "/",
"versionsUrl": "",
"versions": "",
"siteUrl": "",
"title": "Docs",
"structuredData": {}
}Create a default.json file in the content project, in the folder defined by the CONFIG_PATH variable — dspublisher/config, by default — and override the properties you need. You don’t have to repeat the default values.
You can also define a production.json configuration file in the same folder, to use a different configuration for your production build.
With the configuration files in place, you can use execute npm run dspublisher:start, or npm run dspublisher:build without extra command-line parameters.