Custom Hugo Shortcodes

This page explains the custom Hugo shortcodes that can be used in Flux Markdown documentation.

Read more about shortcodes in the Hugo documentation.

Code snippets

You can embed code snippets from a file.

language is any language supported by GitHub flavored markdown.

file is the path to the file you want to use in the code block.

{{% codeblock file="/static/snippet/example.yaml" language="yaml" %}}
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
  name: podinfo
  namespace: flux-system
spec:
  interval: 1m
  url: https://github.com/stefanprodan/podinfo
  ref:
    branch: master
  ignore: |
    # exclude all
    /*
    # include charts directory
    !/charts/    

Tabbed sections

You can create tabbed sections that contain both markdown and code snippets.

{{% tabs %}}
{{% tab "codeblock and text in a tab" %}}

cool sample text

{{% codeblock file="/static/snippet/example.yaml" language="yaml" %}}

{{% /tab %}}
{{% tab "codeblock in a tab" %}}

{{% codeblock file="/static/snippet/example.yaml" language="yaml" %}}

{{% /tab %}}
{{% tab "text in a tab" %}}

cool sample text

{{% /tab %}}{{% /tabs %}}

cool sample text

apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
  name: podinfo
  namespace: flux-system
spec:
  interval: 1m
  url: https://github.com/stefanprodan/podinfo
  ref:
    branch: master
  ignore: |
    # exclude all
    /*
    # include charts directory
    !/charts/    

apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
  name: podinfo
  namespace: flux-system
spec:
  interval: 1m
  url: https://github.com/stefanprodan/podinfo
  ref:
    branch: master
  ignore: |
    # exclude all
    /*
    # include charts directory
    !/charts/    

cool sample text