The first step is to create a content type with a text element for the code of the sample, together with a selector of the programming language the code uses.The programming language selector is important because you need to instruct your website or app how to display the code, especially what syntaxt highlighting to use.
Add an option for every language your content creators and developers use.
Mark the element as required because every code sample uses some language.
Set the element to display as radio buttons.
Radio buttons allow only a single option to be selected, which makes sense because code samples usually use one language predominantly and need syntax highlighting for that language only.
Insert code samples into your content
When you have the content type for code samples defined, you can start adding samples to your articles:
InContent & assets, open an article for editing.
Place the cursor into a rich text element where you want to add a code sample.
In the editor toolbar, click and then.
Select the content type for code samples.
Fill in the elements.
Use taxonomies for bulk publishing
As your content grows bigger, you benefit from organizing your content into smaller groups such as releases. You create these groups by tagging your content. You can then plan your releases, see what's scheduled for each release, and perform bulk operations like publishing or changing workflow.
From single-use to re-useIf you later find another use for the content in your component, you can always convert it to a content item by clicking .This conversion cannot be undone. If done by accident, archive the new item and create your component again.