<p>I had this exact same issue on a recent project and found adding the "raw" filter to my field code was necessary to make some embeds work. So instead of this:</p>

<pre><code>{{ entry.videoFieldName }}
</code></pre>

<p>This:</p>

<pre><code>{{ entry.videoFieldName | raw }}
</code></pre>

<p>That prevents Twig from trying to escape any of the characters in your embed code, which will break Vimeo embeds. This is assuming you're just wanting to paste the plain text embed code into a plain text field or Matrix block.</p>

CC BY-SA 3.0
2016-02-06T03:34:47.930Z
works perfectly!
stan60457
CC BY-SA 3.0
2016-02-03T04:56:54.540Z
2016-02-03T06:04:59.783Z
2016-02-03T06:04:59.783Z
Seamus Holman
<p>I am assuming you're using a rich text field?</p>

<p>If that's the case, Redactor (the library that powers rich text editing in Craft) has a video embed plugin: <a href="https://imperavi.com/redactor/plugins/video/" rel="nofollow noreferrer">https://imperavi.com/redactor/plugins/video/</a></p>

<p>To install Redactor plugins in Craft, see this post to get you started: <a href="https://craftcms.stackexchange.com/questions/9881/install-redactor-plugin">Install Redactor plugin</a></p>

<hr>

<p>However this kind of content complexity was really what the Matrix field type was made for. Mixing text and media elements in a single field can get quite cumbersome. This video should help you understand how you can implement mixing text and embedded video the "Craft" way: <a href="https://craftcms.com/features/matrix" rel="nofollow noreferrer">https://craftcms.com/features/matrix</a></p>

CC BY-SA 3.0
2016-01-21T04:12:51.517Z
Thanks, so with Matrix I can add a block and be able to embed my Vimeo code in that?
stan60457
CC BY-SA 3.0
2016-01-21T04:25:18.840Z
One way you could do it is create a Video block type, which has a field where you can paste in the link to the video. Then use the Embedder plugin to transform that link to an embed code in the template.
Ben Fleming
CC BY-SA 3.0
2016-01-21T04:27:38.600Z
Another would be to use (shameless plug to my own plugin) [Embedded Assets](https://github.com/benjamminf/craft-embedded-assets/) if you're reusing embedded videos a lot. There's a million other ways you can do it, which is a testament to the power of Craft.
Ben Fleming
CC BY-SA 3.0
2016-01-31T14:34:18.470Z
Can you provide an example of how to use it in a template?                     <div class="mainvideo">
      {% for asset in assets %}
      <img src="{{ asset.url }}">
            {% set embed = craft.embeddedAssets.fromAsset(asset) %}
            {% if embed %}
              {{ embed.safeHtml }}
            {% endif %}
        {% endfor %}
  </div>
stan60457
CC BY-SA 3.0
2016-02-01T03:51:34.017Z
That code should be pretty much it! All you need to do is create an asset field inside your video matrix block, maybe limit it to one asset (and if you want to only allow embedded assets, limit the filetype to JSON), then in your template: `<div class="mainvideo"> {% set asset = block.assetField.first %} {% set video = craft.embeddedAssets.fromAsset(asset) %} {% if video %} {{ embed.safeHtml }} {% endif %} </div>`
Ben Fleming
CC BY-SA 3.0
2016-02-01T04:00:21.520Z
In case I'm not being clear enough, here's some screenshots of how I'd might implement it into the site I'm currently building: http://imgur.com/a/SXFOj
Ben Fleming
CC BY-SA 3.0
2016-02-02T02:54:02.967Z
Thanks for posting this! I'm still having trouble. My Vimeo file doesn't seem to be correct. I posted it here-http://imgur.com/share/a/9hWzD.
stan60457
CC BY-SA 3.0
2016-01-21T04:00:16.910Z
2016-01-21T04:00:16.910Z
2017-04-13T12:50:59.930Z
Ben Fleming
<p>I am trying to paste Vimeo's embed code to the body of an entry like this-</p>



<p>and instead of showing the video, I get a link to the video. Can I embed it this way by putting the code in the body field? Or do I need to 
use a plugin such as Embedder?</p>

<plugin-embedder>
Vimeo Embedding
# Vimeo Embedding

(Asked by: username_0 on 2016-01-21)

I am trying to paste Vimeo's embed code to the body of an entry like this-

and instead of showing the video, I get a link to the video. Can I embed it this way by putting the code in the body field? Or do I need to
use a plugin such as Embedder?

**Tags:** plugin-embedder

---

## 2 answers

### Answer by username_1 on 2016-02-03. Score: 4

I had this exact same issue on a recent project and found adding the "raw" filter to my field code was necessary to make some embeds work. So instead of this:
{{ entry.videoFieldName }}

This:
{{ entry.videoFieldName | raw }}

That prevents Twig from trying to escape any of the characters in your embed code, which will break Vimeo embeds. This is assuming you're just wanting to paste the plain text embed code into a plain text field or Matrix block.

> **Comments:**
> **username_0**: works perfectly!  

---

### Answer by username_2 on 2016-01-21. Score: 3

I am assuming you're using a rich text field?

If that's the case, Redactor (the library that powers rich text editing in Craft) has a video embed plugin: <https://imperavi.com/redactor/plugins/video/>

To install Redactor plugins in Craft, see this post to get you started: [Install Redactor plugin](https://craftcms.stackexchange.com/questions/9881/install-redactor-plugin)

---

However this kind of content complexity was really what the Matrix field type was made for. Mixing text and media elements in a single field can get quite cumbersome. This video should help you understand how you can implement mixing text and embedded video the "Craft" way: <https://craftcms.com/features/matrix>

> **Comments:**
> **username_0**: Thanks, so with Matrix I can add a block and be able to embed my Vimeo code in that?  
> **username_2**: One way you could do it is create a Video block type, which has a field where you can paste in the link to the video. Then use the Embedder plugin to transform that link to an embed code in the template.  
> **username_2**: Another would be to use (shameless plug to my own plugin) [Embedded Assets](https://github.com/benjamminf/craft-embedded-assets/) if you're reusing embedded videos a lot. There's a million other ways you can do it, which is a testament to the power of Craft.  
> **username_0**: Can you provide an example of how to use it in a template?                     <div class="mainvideo">       {% for asset in assets %}       <img src="{{ asset.url }}">             {% set embed = craft.embeddedAssets.fromAsset(asset) %}             {% if embed %}               {{ embed.safeHtml }}             {% endif %}         {% endfor %}   </div>  
> **username_2**: That code should be pretty much it! All you need to do is create an asset field inside your video matrix block, maybe limit it to one asset (and if you want to only allow embedded assets, limit the filetype to JSON), then in your template: `<div class="mainvideo"> {% set asset = block.assetField.first %} {% set video = craft.embeddedAssets.fromAsset(asset) %} {% if video %} {{ embed.safeHtml }} {% endif %} </div>`  
> **username_2**: In case I'm not being clear enough, here's some screenshots of how I'd might implement it into the site I'm currently building: http://imgur.com/a/SXFOj  
> **username_0**: Thanks for posting this! I'm still having trouble. My Vimeo file doesn't seem to be correct. I posted it here-http://imgur.com/share/a/9hWzD.  

---

