<p>Store it in a plaintext field, then when you output it, do: <code>{{ entry.myfield | raw }}</code></p>

CC BY-SA 3.0
2015-11-27T21:30:19.780Z
2015-11-27T21:30:19.780Z
andrew.welch
<p>I need to store Javascript/HTML code in some of our entries. I have tried to put the code in plaintext but cannot get the code to render through twig. I cannot store this stuff on the filesystem. It really needs to be attached to an entry if possible.</p>

<p>Any ideas?</p>

CC BY-SA 3.0
2015-11-28T20:26:42.123Z
There are a few plugins which make adding code to entries a nicer experience... Check out [Ace Freely](https://github.com/httpster/Ace-Freely) or [Code Block](https://github.com/lindseydiloreto/craft-codeblock).
Lindsey D
<fieldtypes>
How do I store code in Craft
# How do I store code in Craft

(Asked by: username_0 on 2015-11-27)

I need to store Javascript/HTML code in some of our entries. I have tried to put the code in plaintext but cannot get the code to render through twig. I cannot store this stuff on the filesystem. It really needs to be attached to an entry if possible.

Any ideas?

**Tags:** fieldtypes
> **Comments:**
> **username_1**: There are a few plugins which make adding code to entries a nicer experience... Check out [Ace Freely](https://github.com/httpster/Ace-Freely) or [Code Block](https://github.com/lindseydiloreto/craft-codeblock).  

---

## 1 answers

### Answer by username_2 on 2015-11-27. Score: 4 | Accepted answer

Store it in a plaintext field, then when you output it, do: `{{ entry.myfield | raw }}`


---

