docs icon indicating copy to clipboard operation
docs copied to clipboard

Load example manifests and embed them inline

Open negz opened this issue 4 months ago • 1 comments

Our docs have plenty of example manifests that users should apply. Especially the getting started guides. We've used a few approaches to this over the years and have rarely been consistent:

  1. Plain YAML, with instructions saying to save it to a file and apply it
  2. YAML wrapped in a kubectl apply command with a bash HERE/EOF doc
  3. Plain YAML, with duplicated plain YAML in a manifests dir that you can kubectl apply -f https://do...

These all have downsides. The first makes copying less convenient for the user. The second makes the YAML manifest look uglier - wrapped in somewhat arcane shell syntax. The third means maintaining duplicate manifests.

Last time we brainstormed this with @tr0njavolta they had a good suggestion, which is a variant of 3:

  • Manifests defined only in a file in the docs repo, under e.g. content/manifests/
  • Use Hugo to embed manifests inline in the docs
  • Show kubectl apply -f https://docs.crossplane.io/v2.0/manifests/... style examples

I believe this is what the Kubernetes docs do. I'd like us to adopt this approach.

negz avatar Aug 08 '25 19:08 negz

Yes, this would be a nice UX improvement for folks following the guides in the docs. I'm going to transfer this to the docs repo.

edit: this is already in the docs repo, leaving my shame here for public visibility 😇

jbw976 avatar Oct 23 '25 23:10 jbw976