Table Shortcode

The table shortcode allows you to create styled HTML tables within your Hugo content.
It supports custom headers, optional captions, and automatic styling for light/dark modes.

Usage

Basic Table

GO
1
2
3
4
5
{{< table headers="Name|Age|City" caption="My Table" >}}
John|25|New York
Jane|30|Los Angeles
Bob|28|Chicago
{{< /table >}}

Table Without Caption

GO
1
2
3
4
5
{{< table headers="Product|Price|Stock" >}}
Laptop|1200|10
Monitor|300|15
Keyboard|50|50
{{< /table >}}

Parameters

ParameterRequiredDefaultDescription
headersNo-Pipe-separated list of column headers (e.g., "Name।Age।City")
captionNo-Optional caption displayed below the table
Inner contentYes-Rows of table data separated by newlines, cells separated by `।`
Table: Table Shortcode Parameters

Note: Using id generated from the caption can conflict if multiple tables share the same caption in a single page.


Examples

Table With Mixed Content

NameOccupationCountry
AliceEngineerUSA
BobDesignerCanada
CharlieManagerUK
Table: Team Members

Table With Empty Cells

ItemPriceStock
Laptop120010
Monitor*15
Keyboard50*
Table: Inventory