Shortcodes

Shortcodes can be used to embed videos, attachments, iframes, etc. Pillar supports shortcodes in any field that takes MarkDown markup. By default those are node descriptions (so for assets like videos, textures, etc.), comments, and blog posts.

YouTube

YouTube videos can be embedded using the {youtube} shortcode. This code takes a single parameter indicating which video to embed, which can be the video ID or a URL. Extra attributes width and height are passed directly as-is to the embedding iframe HTML element. Examples are:

  • {youtube RJnKaAtBPhA width=512 height=288}
  • {youtube https://youtu.be/RJnKaAtBPhA}
  • {youtube 'https://www.youtube.com/watch?v=RJnKaAtBPhA'}

Note that when the URL contains an = sign it has to be quoted.

IFrames

IFrames can be embedded using the {iframe src=xxx} shortcode. This shortcode supports two special attributes, cap and nocap. The IFrame is only rendered when the viewing user has the capability indicated by cap; otherwise the message indicated by nocap is shown. If there is no nocap attribute and the user doesn't have the required capability, the IFrame is silently hidden.

Extra attributes are copied directly to the rendered <iframe> HTML element.

Examples are:

  • {iframe src='//www.example.com/'}
  • {iframe src='//www.example.com/only-for-subscribers' cap='subscriber'} will be completely hidden to non-subscriber users.
  • {iframe src='//www.example.com/only-for-subscribers' cap='subscriber' nocap='This content is only available to subscribers'}
  • {iframe src='//www.example.com/' width='100%' height='20em'}

Attachments

Node attachments can be used to embed images in blog posts, asset descriptions, etc. These attachments can be embedded using the {attachment slug} shortcode.

Image attachments support the link attribute to indicate what should happen when the user clicks on it. link=self, or just link without value, will simply link to the image itself. link='https://example.com/' will link to the given URL.

Examples are:

  • {attachment the-blend-file}
  • {attachment some-img link} is equivalent to {attachment some-img link=self}
  • {attachment some-img link='//cloud.blender.org/hero'}