<p>There is also a nice plugin called <a href="https://github.com/ehousestudio/craft_hacksaw/" rel="nofollow">Hacksaw</a> that gives you a handful of helpers. With this you can do <code>{{ entry.title|hack(words='1') }}</code></p>

CC BY-SA 3.0
2016-05-27T18:01:57.527Z
2016-10-15T18:10:12.100Z
2016-10-15T18:10:12.100Z
Pautomagi
<p>Yes, you can do this with Twig alone. Here's how:</p>

<pre><code>{{ entry.title|split(' ')|slice(0, 1)|join }}
</code></pre>

<p>This series of Twig filters:</p>

<ol>
<li>Uses <code>split</code> to turn the title into an array, splitting on spaces.</li>
<li>Passes that array through <code>slice</code> to grab the first item in the array.</li>
<li>Then uses <code>join</code> to turn the array back into a string for output. The array is now just one item (the first word of the title), but <code>join</code> is needed because Twig doesn't want to treat an array as a string.</li>
</ol>

CC BY-SA 3.0
2016-05-24T18:55:06.813Z
2016-10-15T17:15:21.300Z
2016-10-15T17:15:21.300Z
Gavin Anderegg
<p>Is it possible to output only the first word of the title of an entry in a template? If so, how? Thanks!</p>

<templating><titles>
How Can I Output Only the First Word of the Title of an Entry in a Template?
# How Can I Output Only the First Word of the Title of an Entry in a Template?

(Asked by: username_0 on 2016-05-24)

Is it possible to output only the first word of the title of an entry in a template? If so, how? Thanks!

**Tags:** templating, titles


---

## 2 answers

### Answer by username_2 on 2016-05-24. Score: 12 | Accepted answer

Yes, you can do this with Twig alone. Here's how:
{{ entry.title|split(' ')|slice(0, 1)|join }}

This series of Twig filters:

Uses split to turn the title into an array, splitting on spaces.
Passes that array through slice to grab the first item in the array.
Then uses join to turn the array back into a string for output. The array is now just one item (the first word of the title), but join is needed because Twig doesn't want to treat an array as a string.


---

### Answer by username_1 on 2016-05-27. Score: 5

There is also a nice plugin called [Hacksaw](https://github.com/ehousestudio/craft_hacksaw/) that gives you a handful of helpers. With this you can do `{{ entry.title|hack(words='1') }}`


---

