knutlabs

Hugo Content Cheat Sheet

This post is a living reference of every content feature available on knutlabs. Use it as a guide when writing new posts.


1. Markdown Basics

Headings

Use # for headings. Here are the levels available inside a post (H2–H4 are most common):

Heading 2

Heading 3

Heading 4

Text Formatting

Syntax Result
**bold** bold
*italic* italic
~~strikethrough~~ strikethrough
`inline code` inline code

You can also combine them: bold italic, bold strikethrough.

Unordered Lists

  • First item
  • Second item
    • Nested item
    • Another nested item
  • Third item

Ordered Lists

  1. First step
  2. Second step
  3. Third step
    1. Sub-step A
    2. Sub-step B

Blockquotes

This is a blockquote. Use it to call out important quotes or to highlight a key idea from someone else’s work.

Blockquotes can also be nested:

Like this inner quote.

Horizontal Rule

Use --- to create a horizontal divider:


Standard markdown links:

Images

Standard markdown image syntax:

![Alt text description](/images/example.png)

Tables

Service Port Protocol
HTTP 80 TCP
HTTPS 443 TCP
DNS 53 UDP/TCP
SSH 22 TCP

Tables support left, center, and right alignment:

Left Center Right
A B C
1 2 3

2. Code Blocks

Inline Code

Use backticks for inline code like variable names or commands.

Fenced Code Blocks

Use triple backticks with a language name for syntax highlighting:

#!/bin/bash
echo "Hello from knutlabs"
systemctl status nginx
def greet(name: str) -> str:
    return f"Hello, {name}!"

print(greet("knutlabs"))
apiVersion: v1
kind: Service
metadata:
  name: knutlabs-web
spec:
  selector:
    app: web
  ports:
    - port: 80
      targetPort: 8080
package main

import "fmt"

func main() {
    fmt.Println("hello world")
}

Syntax Highlighting Shortcode

Hugo’s built-in highlight shortcode gives you extra control like line numbers:

1
2
3
4
import os

SECRET = os.environ["API_KEY"]  # highlighted line
print(f"Key length: {len(SECRET)}")

3. Code Dropdown

Use the custom code-dropdown shortcode to hide long code blocks behind a collapsible toggle:

```nginx server { listen 80; server_name app.knutlabs.com; location / { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } ```
```hcl provider "aws" { region = "us-east-1" } resource "aws_instance" "web" { ami = "ami-0c55b159cbfafe1f0" instance_type = "t2.micro" tags = { Name = "knutlabs-web" } } ```

4. Hint / Callout Blocks

Three severity levels to draw attention to important information:

Info

Tip: You can use the hugo server -D flag to include draft posts when running the local dev server.

Warning

Caution: Modifying firewall rules on a production server without a rollback plan can lock you out permanently.

Danger

Do not commit API keys, passwords, or TLS certificates to version control. Use a secrets manager instead.

5. Tabs

Use tabs when you want to show the same concept in multiple languages or contexts:

print("hello from Python")
fmt.Println("hello from Go")
echo "hello from Bash"

Another example — OS-specific install instructions:

sudo apt update
sudo apt install nginx
sudo yum install nginx
brew install nginx

6. Collapsible Sections (Details)

For content that’s useful but not essential — hide it behind a click:

Click to see the full error log
2026-02-14 10:32:01 ERROR [nginx] upstream timed out
  (110: Connection timed out) while connecting to upstream
  client: 192.168.1.50
  server: app.knutlabs.com
  request: "GET /api/health HTTP/1.1"
  upstream: "http://127.0.0.1:3000/api/health"
Explanation of subnet masks

A subnet mask determines which portion of an IP address is the network part and which is the host part.

  • /24 = 255.255.255.0 → 254 usable hosts
  • /16 = 255.255.0.0 → 65,534 usable hosts
  • /8 = 255.0.0.0 → 16,777,214 usable hosts

7. Buttons

Link buttons for calls to action:

Hugo Documentation Visit GitHub

8. Download Button

Provide a file download link styled as a button. Place files in the static/ directory and reference them:

Download example-config.yaml
{{< download file="/files/example-config.yaml" name="Download example-config.yaml" >}}

Parameters:

Parameter Required Description
file yes Path to the file (relative to static/)
name no Button label (defaults to the file path)

9. Figure (Image with Caption)

The figure shortcode adds a caption below an image:

{{< figure src="/images/diagram.png" title="Network topology diagram" >}}

This renders an <img> inside a <figure> element with a <figcaption>.


10. Mermaid Diagrams

Render flowcharts, sequence diagrams, and more using Mermaid syntax:

Flowchart

graph TD A[Client Request] --> B{Load Balancer} B --> C[Server 1] B --> D[Server 2] B --> E[Server 3] C --> F[(Database)] D --> F E --> F

Sequence Diagram

sequenceDiagram participant Client participant Proxy participant Backend Client->>Proxy: HTTPS request Proxy->>Backend: HTTP request Backend-->>Proxy: JSON response Proxy-->>Client: HTTPS response

11. Math (LaTeX)

Render mathematical formulas with KaTeX. Use $$ for display (block) math and $ for inline math.

Display Math

$$ E = mc^2 $$

$$ \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} $$

Inline Math

The formula for bandwidth-delay product is $BDP = bandwidth \times RTT$, measured in bits.


12. Emoji

Hugo supports emoji when enableEmoji = true in the config. Use standard shortcodes:

  • 🚀 :rocket:
  • :white_check_mark:
  • ⚠️ :warning:
  • 🔥 :fire:
  • 🔧 :wrench:
  • 📖 :book:
  • 🌐 :globe_with_meridians:

13. Front Matter Reference

Every post starts with YAML front matter between --- delimiters:

```yaml --- title: "My Post Title" date: 2026-02-14 draft: false labels: ["Solution", "Automation"] summary: "A short description shown in the sidebar." --- ```

Available Fields

Field Type Description
title string Post title (required)
date date Publication date for ordering
draft bool If true, only visible with -D flag
labels list Labels for filtering (e.g. Solution, Feature, RFC)
summary string Short description used in search and metadata

Standard Labels

The following labels are used across knutlabs:

Solution · Feature · Test · Protocol · RFC · Automation · Migration · NOC · Security


Quick Reference

Feature Syntax
Code dropdown {{< code-dropdown title="..." >}} ... {{< /code-dropdown >}}
Hint block {{< hint info >}} ... {{< /hint >}}
Tabs {{< tabs >}} {{< tab "Name" >}} ... {{< /tab >}} {{< /tabs >}}
Collapsible {{< details "Title" >}} ... {{< /details >}}
Button {{< button href="..." >}} Text {{< /button >}}
Download {{< download file="/files/name.ext" name="Label" >}}
Mermaid {{< mermaid >}} graph TD ... {{< /mermaid >}}
Figure {{< figure src="..." title="..." >}}
Highlight {{< highlight lang "opts" >}} ... {{< /highlight >}}
Math (block) $$ formula $$
Math (inline) $ formula $
Emoji :rocket: → 🚀