Skip to content

Embed example manifests inline via shortcode (#960)#1086

Open
jonasz-lasut wants to merge 3 commits into
crossplane:masterfrom
jonasz-lasut:inline-manifests-squashed
Open

Embed example manifests inline via shortcode (#960)#1086
jonasz-lasut wants to merge 3 commits into
crossplane:masterfrom
jonasz-lasut:inline-manifests-squashed

Conversation

@jonasz-lasut
Copy link
Copy Markdown

@jonasz-lasut jonasz-lasut commented Apr 28, 2026

Replaces the inconsistent mix of save-and-apply YAML, kubectl heredocs, and duplicated manifest files with a single mechanism: example manifests live as real .yaml files under
content//manifests/.yaml, embedded into prose by a new {{< manifest >}} shortcode and simultaneously published as fetchable URLs at https://docs.crossplane.io/<ver>/manifests/... so readers can run kubectl apply -f <url> directly.

I see room for improvement in the future by moving Function manifests to a separate directory and use the shared functions in all docs across all versions as this way we'll be able to update Function versions in one place only.

Fixes #960

Changes:

  • Adds a Hugo module mount in config.yaml that re-exposes content/<ver>/manifests/**.yaml under static/, so each manifest publishes verbatim at its natural URL.

  • Adds themes/geekboot/layouts/shortcodes/manifest.html. Required arg path= names the manifest relative to the calling page's version. The shortcode auto-derives the version segment from .Page.File.Path so authors never type version strings. Optional args: apply="false" suppresses the kubectl block; command= overrides the default verb (kubectl apply -f); label= wraps the rendered YAML in <div label="..."> so existing {{< hover label="..." >}} annotations keep working. Hostname is based on base URL so preview deploys still emit usable kubectl URLs.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 28, 2026

Deploy Preview for crossplane ready!

Name Link
🔨 Latest commit dd2ebb5
🔍 Latest deploy log https://app.netlify.com/projects/crossplane/deploys/6a02882e96951500088f0341
😎 Deploy Preview https://deploy-preview-1086--crossplane.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 93 (no change from production)
Accessibility: 90 (🔴 down 2 from production)
Best Practices: 92 (no change from production)
SEO: 100 (no change from production)
PWA: 70 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@jonasz-lasut jonasz-lasut force-pushed the inline-manifests-squashed branch 3 times, most recently from 2c1b789 to 522ac0a Compare April 28, 2026 10:57
@jonasz-lasut jonasz-lasut reopened this Apr 28, 2026
@jonasz-lasut jonasz-lasut force-pushed the inline-manifests-squashed branch 2 times, most recently from 2ac5d78 to d365ad9 Compare April 28, 2026 11:41
@jonasz-lasut jonasz-lasut marked this pull request as ready for review April 28, 2026 11:42
@jonasz-lasut jonasz-lasut force-pushed the inline-manifests-squashed branch from d365ad9 to 9db2446 Compare April 28, 2026 11:43
@tr0njavolta
Copy link
Copy Markdown
Collaborator

Thanks for the contribution @jonasz-lasut! I was able to review and test:

  • Core functionality
    • kubectl apply -f works
    • kubectl edit -f works
    • kubectl apply --dry-run=client passes for all manifests across all versions
    • Missing manifest file returns build error.
  • Shortcode combinations
    • {{< manifest >}} inside {{< tabs >}} works
    • {{< manifest >}} inside {{< expand >}} works
    • apply="false" inside {{< hint >}} works
    • {{< hover >}} on manifests works

Couple things I noticed:

  • Hover targeting a manifest inside a tab doesn't render the line highlighting but isn't a blocking error.
  • Local hugo build absURL produces //localhost/1313/.... Doesn't affect production but breaks copy-paste testing during doc authoring. Manually updating to http://localhost/1313/... works.

I created a PR to your forked branch to add usage information to the docs code styling guide.. Once that's accepted or edited, we'll be good to approve and merge 🚀

@tr0njavolta tr0njavolta self-requested a review May 11, 2026 19:12
Copy link
Copy Markdown
Collaborator

@tr0njavolta tr0njavolta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting a usage guide for the shortcode in https://docs.crossplane.io/contribute/code-style-guide/. Created a PR here

@jonasz-lasut
Copy link
Copy Markdown
Author

Really appreciate the review @tr0njavolta
I've merged the PR that you've opened against my fork without changes, thank you for finding time to test all functionalities.

I'll take a look at fixing hover inside a tab and localhost baseUrl in the follow-up PR sometime next week :)

@jonasz-lasut
Copy link
Copy Markdown
Author

Looks like your commit was missing a signoff, I've invited you as a collaborator on my fork so you should be able to push directly to the branch

Replaces the inconsistent mix of save-and-apply YAML, kubectl
heredocs, and duplicated manifest files with a single mechanism:
example manifests live as real .yaml files

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Jonasz Łasut-Balcerzak <jonasz.lasut@gmail.com>
Signed-off-by: Rae Sharp <resharp20@gmail.com>
@tr0njavolta tr0njavolta force-pushed the inline-manifests-squashed branch from 6f11719 to 809144d Compare May 11, 2026 19:49
@tr0njavolta tr0njavolta self-requested a review May 11, 2026 19:50
@tr0njavolta tr0njavolta self-requested a review May 11, 2026 19:52
Signed-off-by: Rae Sharp <resharp20@gmail.com>
Copy link
Copy Markdown
Member

@jbw976 jbw976 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you so much for taking this on @jonasz-lasut, i think it's a lot easier/quicker to walk through the interactive guides now than the previous approach of copying the content to a file each time. This is very appreciated!! 🙇

I added two small comments of things I noticed, none of them are explicitly blocking - I'll add my approval on as well and we can merge tomorrow either way 😁


{{- $highlightOpts := "linenos=table,linenostart=1" -}}

<div class="gdoc-manifest">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one funny thing i noticed is that the manifest code blocks now seem to use a blue/green color for their line numbers, when before they were a grey color. Is something in the logic here affecting that? Compare the line number colors on these two:

Current: https://docs.crossplane.io/v2.2/guides/change-logs/#configure-permissions

Image

NEW: https://deploy-preview-1086--crossplane.netlify.app/v2.2/guides/change-logs/#configure-permissions

Image


{{< manifest path="code-style-guide/provider.yaml" apply="false" >}}

### `generateName`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it also worth mentioning the manifest-url function in this contributing guide page? i see it used quite a lot on some pages like https://deploy-preview-1086--crossplane.netlify.app/v2.2/get-started/get-started-with-composition/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for calling this out - added a mention in the contributing guide.

Signed-off-by: Rae Sharp <resharp20@gmail.com>

Vale exception

Signed-off-by: Rae Sharp <resharp20@gmail.com>

Fix language and mismatched backticks

Signed-off-by: Rae Sharp <resharp20@gmail.com>
@tr0njavolta tr0njavolta force-pushed the inline-manifests-squashed branch from ba449a9 to dd2ebb5 Compare May 12, 2026 01:53
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.

Load example manifests and embed them inline

3 participants