Skip to content

fix(templates): restore missing space in "Available in" line#18828

Merged
cnunciato merged 1 commit intomasterfrom
fix/template-languages-missing-space
May 7, 2026
Merged

fix(templates): restore missing space in "Available in" line#18828
cnunciato merged 1 commit intomasterfrom
fix/template-languages-missing-space

Conversation

@alexleventer
Copy link
Copy Markdown
Contributor

Summary

  • The Available in byline on template pages was rendering as Available inTypeScript, Python, Go, C#, YAML — no space between "in" and the first language.
  • Cause: Hugo whitespace-trim markers ({{- / -}}) around the items range were eating the newline/indentation between the literal Available in text and the {{ delimit }} call, so they collapsed together at render time.
  • Fix: hoist the items computation above the <p> so the visible markup is a clean Available in {{ delimit $items ", " }}. Behavior is identical otherwise — the partial still no-ops when template.languages isn't set.

Affects any page that uses layouts/templates/template.html (template index/landing pages under /content/templates/...).

Test plan

  • make serve and load a templates page (e.g. /templates/container-service/); confirm the byline now reads "Available in TypeScript, Python, Go, C#" with a single space.
  • Confirm a template page without template.languages in frontmatter still renders no byline.
  • make lint passes.

🤖 Generated with Claude Code

Hugo's whitespace-trim markers around the items range were eating the
space between "Available in" and the rendered language list, so the
template-page byline rendered as "Available inTypeScript, Python, Go,
C#, YAML". Moved the items computation above the <p> so the visible
markup is a clean "Available in {{ delimit ... }}".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alexleventer
Copy link
Copy Markdown
Contributor Author

@claude take a look pls

@pulumi-bot
Copy link
Copy Markdown
Collaborator

pulumi-bot commented May 7, 2026

Claude finished @alexleventer's task in 1m 1s —— View job


Review

The fix looks good — clean and minimal. Approving the approach.

Why the original was broken

In the prior layout the <p> body looked like:

<p ...>
    Available in
    {{- $items := slice -}}     ← `{{-` trims newline + indent before it
    {{- range $languages -}}
        ...
    {{- end -}}                 ← `-}}` trims newline + indent after it
    {{ delimit $items ", " }}
</p>

The {{- on {{- $items := slice -}} ate the newline and indentation between Available in and the directive, and the trailing -}} on {{- end -}} ate the whitespace before {{ delimit ... }}. Result: Available in and the comma-joined languages got concatenated with zero separator.

Why the fix works

Hoisting the items loop above the <p> removes all trim markers from the visible body, leaving a literal space between Available in and {{ delimit ... }} (layouts/partials/templates/languages.html:28-30). The slice/range/end block above the <p> is still wrapped in {{- -}} markers, so it produces no stray whitespace before the paragraph. The {{- end -}} of the outer if at the bottom is unchanged, so the no-op behavior when template.languages is unset is preserved.

The only consumer of this partial is layouts/templates/template.html:14, which is used by the leaf template pages under content/templates/*/<cloud>/index.md (e.g. container-service/aws, virtual-machine/azure) — those are the pages that get the rendered fix.

Nits (non-blocking)

  • None. The diff is +7/-8 and could not really be smaller.

Looks good to merge once the test plan checkboxes are walked through manually.
fix/template-languages-missing-space

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 7, 2026

Docs Review

Small, well-scoped Hugo template fix. The diagnosis matches the symptom — the {{- ... -}} trim markers around the range block were collapsing the whitespace between the literal Available in and the {{ delimit }} output. Hoisting $items above the <p> so the visible markup is just Available in {{ delimit $items ", " }} (no leading - on the delimit action) preserves the space cleanly.

A few notes:

Correctness

  • layouts/partials/templates/languages.html:22-27: the items-building block now sits between the $names dict and the <p> element. Trim markers on every line keep the rendered output free of stray whitespace before the <p>. ✓
  • layouts/partials/templates/languages.html:29: Available in {{ delimit $items ", " }} — no {{- here, so the literal space before {{ survives. ✓
  • The {{- if $languages -}} guard at the top still no-ops when template.languages is unset, matching the partial's documented behavior in the comment block. ✓
  • Only one caller (layouts/templates/template.html:14), so no other partial needs a parallel fix.

Suggestions (optional)

The partial-level docstring at the top is still accurate, but if you wanted to leave a breadcrumb for the next person who tries to inline the loop back into the <p>, a one-line note about why the items list is built outside the <p> could be worth it. Not required — the commit message already captures it.

Style / conventions

  • No content files changed, so STYLE-GUIDE.md doesn't apply.
  • Indentation and trim-marker usage match the surrounding partial.

Looks ready to merge once the test-plan checkboxes are confirmed locally. Mention me (@claude) if you want another pass after changes.

@pulumi-bot
Copy link
Copy Markdown
Collaborator

@pulumi-bot
Copy link
Copy Markdown
Collaborator

Lighthouse Performance Report

Commit: 5b4a5e0 | Metric definitions

Page Device Score FCP LCP TBT CLS SI
Homepage Mobile 🟡 75 2.5s 2.6s 500ms 0.018 6.3s
Homepage Desktop 🟡 84 0.6s 2.1s 24ms 0.067 2.4s
Install Pulumi Mobile 🟡 55 6.3s 14.0s 245ms 0.003 6.3s
Install Pulumi Desktop 🟡 85 1.0s 2.5s 24ms 0.016 1.0s
AWS Get Started Mobile 🟡 50 4.4s 7.3s 272ms 0.138 6.9s
AWS Get Started Desktop 🟡 88 1.0s 1.5s 24ms 0.034 2.5s

@cnunciato cnunciato merged commit 5aba2b1 into master May 7, 2026
9 checks passed
@cnunciato cnunciato deleted the fix/template-languages-missing-space branch May 7, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants