Skip to main content
this section: |

Shortcodes

~4 m

PiHuW provides three shortcodes. Authors use them in markdown pages.


hw — the main dispatcher

hw is the only shortcode most authors ever need. It routes to any visual tool via the t parameter:

1
2
3
4
5
{{< hw t = "image" src = "photo.jpg" alt = "A photo" />}}
{{< hw t = "banner" header = "Welcome" text = "This is the intro." />}}
{{< hw t = "accordion" >}}
  {{< hw t = "acc-tab" header = "Section one" >}}Content here.{{< /hw >}}
{{< /hw >}}

Getting help for any tool

Add help = "yes" to any hw call to replace the rendered output with that tool’s parameter reference card:

1
{{< hw t = "image" help = "yes" />}}

All other parameters are ignored when help is present. Remove it when done.

To show all tool help cards at once:

1
{{< hw t = "help" />}}

Parameter reference

ParameterTypeDescription
tstringTool name — routes to layouts/_partials/tool/{t}.html (required)
helpstringAny value → shows help for t instead of rendering it
optJSONTool-specific options string e.g. '{"no-auto-tag": true}'
sortstringSpace-separated sort keywords: date title type asc desc
altstringAlt text for images and videos
blockClassstringCSS class on the outermost wrapper div
classstringCSS class on the main element
countnumberHow many items to show (listings)
dbgstringAny value → dumps the full parameter dict as a debug panel
descriptionstringBody text or hover text
fromstringPath to source file when t = "include"
headerstringHeading text (supports markdown bold/italic)
headerClassstringCSS class overrides for the header element
headerLinkstringhref wrapped around the header
idstringAnchor id on the block
linkstringDefault href for any clickable element
metastringSecondary text below the header (e.g. date, reading time)
modestringMode string for tools that support multiple display modes
processstringHugo image process string for the full-res asset e.g. fit 600x400
skipnumberHow many items to skip before showing (listings)
srcstringRelative path or URL to an image, video, or resource
srcClassstringCSS class on the media element wrapper
srcIdstringAnchor id on the media element
srcLinkstringhref wrapped around the media element
srcOnstringleft right none — position of media relative to text
srcPosterstringPoster image for video or non-image resources
srcWidthnumberProportion of the column for media (0.0–1.0)
textstringShort markdown rendered as a caption or supplementary text
thumbstringHugo process string for the thumbnail e.g. x100

Inner content (between opening and closing tags) is rendered as markdown after the description.

How the dispatcher works

1
2
3
4
5
{{< hw t = "image" src = "photo.jpg" >}}
        │
        └─► layouts/_partials/hw.html
                    │
                    └─► layouts/_partials/tool/image.html

If t does not match any partial, a diagnostic message is shown in server mode. If help is set, tool/{t}-help.html is loaded instead.

To extend PiHuW, drop a partial named layouts/_partials/tool/mytool.html into your site’s layouts folder. The shortcode will find and call it automatically. Add a layouts/_partials/tool/mytool-help.html peer to enable inline help.


pihuw — styled theme name

Prints the PiHuW theme name in its branded colours.

1
2
3
{{< pihuw />}}              →  PiHuW
{{< pihuw "-v" />}}         →  PiHuW v1.3.5
{{< pihuw "--version" />}}  →  v1.3.5

Source: layouts/_shortcodes/pihuw.html


H — numbered heading

Renders a numbered heading using the site’s heading counter. The heading number increments automatically across shortcode calls on the same page.

1
2
3
{{< H 1 />}} First section   →  1. First section
{{< H 2 />}} A subsection    →  1.1. A subsection
{{< H 1 />}} Second section  →  2. Second section

The positional parameter is the heading level (1–6, default 1). Heading style is controlled by params.yaml under ui.headings.

Source: layouts/_shortcodes/H.html → layouts/_partials/tmpl/numbered-header.html