Front matter


Overview

Front Matter serves two purposes:

  • Indicates that the file should be included as an article in the build process
  • Allows you to set properties for your article

For example:

---
title: Presidium
slug: overview
url: front-matter/overview
weight: 1
authors: github-username
roles: Developer
status: Draft
---

Presidium includes the following front matter variables:

VariableDescription
titleA string representing the article or subsection title or the title of the subsection.
slugA string representing the slug for deep linking the article
urlA string representing the URL for the article
weightA number to provide ordering of articles, a higher number means the article will appear later in the section
authorA string, generally the Github username of the main author of the article.
githubA string, representing the Github username of the main author of the article.
rolesA list of strings representing the appropriate roles for an article.
statusA string that indicates the status of the article (draft, complete, in progress, etc.)

Authors

Every article can include an author in the front matter:

---
author: {author name}
---

Optional links to authors can be enabled by setting a base URL in the site config:

params:
  author:
    external:
      url: https://github.com/
      newTab: false

To customize the label for authors, provide a new label in the site config:

params:
  author:
    label: Custom Label

To hide or show authors on your generated site, enable or disable the component in the site config:

params:
  show:
    author: true|false

User Roles

Various roles can be added to a site to allow readers to filter articles and menu items by a target audience.

This optional feature can be enabled by defining user roles in the site config.

params:
  roles:
    label: "Show documentation for"
    all: "All Roles"
    options:
      - "Business Analyst"
      - "Developers"
      - "Testers"

If a role is not specified, articles default to roles.all

Articles can have one or more roles defined in front-matter:

---
roles: [Developer, Business Analyst]
---
---
roles: [Developer]
---

To show or hide roles on articles in your generated site, use the following setting in the site config:

params:
  show:
    roles: true|false

Statuses

Each article can be assigned a status to track its lifecycle:

  • draft
  • review
  • published
  • retired

Statuses can be set in the site’s front matter:

---
status: draft|review|published|retired
---

To show or hide statuses on your generated site, use the following setting in the site config:

params:
  show:
    status: true|false

External URLs

Sections can redirect to an external URL either in the same tab or a new one.

This can be done by setting the externalUrl in the site config like so:

menu:
  main:
    - identifier: external-link
      name: External Link
      url: /
      weight: 1
      params:
        externalUrl:
          href: "https://www.anothersite.com"
          newTab: true
    - identifier: another-external-link
      name: Another External Link
      url: /
      weight: 2
      params:
        externalUrl:
          href: "https://www.anothersite.com"
          newTab: false 

The newTab attribute is optional and defaults to true


© Copyright 2024 SPAN Digital

Generated on Jan 17, 2024