# Embeds, shortcodes and view post processing

**URL:** <https://discourse.farcrycore.org/t/embeds-shortcodes-and-view-post-processing/178>\
**Category:** howto\
**Created:** [May 27, 2014, 6:32am UTC](https://discourse.farcrycore.org/t/embeds-shortcodes-and-view-post-processing/178 "2014-05-27T06:32:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![modius](https://discourse.farcrycore.org/user_avatar/discourse.farcrycore.org/modius/32/1197_2.png) [@modius](https://discourse.farcrycore.org/u/modius)\
**Post date:** [May 27, 2014, 6:32am UTC](https://discourse.farcrycore.org/t/embeds-shortcodes-and-view-post-processing/178/1 "2014-05-27T06:32:01Z")

</div>

## Easy Embeds for Views

Ever wanted to just add a link to a YouTube or Vimeo video in your content and have the system convert it to the right embed code? How about a Tweet, or a Gist? If the embed changes (or your design changes!) how cool would it be to just update a central location and have all your embeds update?

Oh, and ever tried to man handle a large embed in a rich text editor like tinyMCE? It can be more than a bit messy. One seriously cool solution is to post-process your content. Have contributors add URLs or “ShortCodes” into their content and then let the view automatically determine what the right embed should be.

For example, simple URLs for a YouTube video and a Tweet in the body content…

 ![](https://discourse.farcrycore.org/uploads/default/original/1X/59371107ceebe8d5c9f0335a00a8a2f6e29ca226.png) 

get transformed into a beautiful embed for your page 😄

 ![](https://discourse.farcrycore.org/uploads/default/original/1X/831e02281174bf83ded8f0d6b5ad03fefca68331.jpg) 

## Activating post processing functions

Post processing can be added to a webskin using the `@@postprocess` webskin decorator, and those transformations will be applied before the webskin is cached:

```auto
<!--- @@postprocess: youtube(width=720,height=405);gist;twitter --->

```

This can be applied more selectively with a function or a tag:

```auto
<!--- using a function call --->
<cfset result = application.fc.lib.postprocess.apply(stObj.body,"youtube(width=720,height=405);gist")>
 
<!--- using a custom tag call from the ./tags/webskin library --->
<skin:postprocess functions="youtube(width=720,height=405);gist">#stObj.body#</skin:postprocess>

```

The function strings must be a semi-colon ( ; ) separated list of functions in the form:

`[libraryname.]function[(arg1=val1,arg2=val2)]`

With:

- an optional library name (this is the name of a component in the lib package in core, your project, or any plugin)
- optional arguments (must be named)

These embed functions have been included in core by default:

- `youtube([width],[height])` recognises standard and shortform YouTube video URLs
- vimeo([width],[height]) for the Vimeo video service [http://vimeo.com/](http://vimeo.com/)
- `gist` embeds GitHub code Gists [https://gist.github.com/](https://gist.github.com/)
- `twitter` for single Tweets [https://twitter.com/](https://twitter.com/)
- `removewhitespace` to deal with excessive whitespace
- `rewriteImages` to help with legacy image sources if you are migrating to a CDN
- `vine([width],[height],[type])` looping video embeds [https://vine.co/](https://vine.co/)
- `storify` [https://storify.com/](https://storify.com/)
- `polldaddy` surveys and polls [http://polldaddy.com/](http://polldaddy.com/)

You can add your own project specific post-processing functions by creating a `./packages/lib/postprocess.cfc` component and extending `./core/packages/lib/postprocess.cfc` from the core framework.

> View post processing functions were added in the FarCry 6.2.3 release, and is available in every release since

---

<div class="post-metadata">

**Author:** ![modius](https://discourse.farcrycore.org/user_avatar/discourse.farcrycore.org/modius/32/1197_2.png) [@modius](https://discourse.farcrycore.org/u/modius)\
**Post date:** [June 4, 2014, 2:32am UTC](https://discourse.farcrycore.org/t/embeds-shortcodes-and-view-post-processing/178/2 "2014-06-04T02:32:27Z")

</div>

Yay! @blair added more post process functions to the default library (`p700` maintenance branch):

- [Poll Daddy](http://polldaddy.com/)
- [Storify](https://storify.com/)

> <https://github.com/farcrycore/core/commit/796b8eb06211>

---

<div class="post-metadata">

**Author:** ![modius](https://discourse.farcrycore.org/user_avatar/discourse.farcrycore.org/modius/32/1197_2.png) [@modius](https://discourse.farcrycore.org/u/modius)\
**Post date:** [July 15, 2014, 11:09pm UTC](https://discourse.farcrycore.org/t/embeds-shortcodes-and-view-post-processing/178/5 "2014-07-15T23:09:34Z")

</div>

Split this topic on July 15, 2014, 11:09pm UTC

I moved a post to a new topic: [Dynamic image gallery creation using post processing](https://discourse.farcrycore.org/t/dynamic-image-gallery-creation-using-post-processing/254)

---

<div class="post-metadata">

**Author:** ![modius](https://discourse.farcrycore.org/user_avatar/discourse.farcrycore.org/modius/32/1197_2.png) [@modius](https://discourse.farcrycore.org/u/modius)\
**Post date:** [January 28, 2015, 7:32am UTC](https://discourse.farcrycore.org/t/embeds-shortcodes-and-view-post-processing/178/6 "2015-01-28T07:32:34Z")

</div>

Forgot to mention @jorgenskogas pull request for Google Calendar embed support… nice 😄

> <https://github.com/farcrycore/core/pull/13>
