<p>The issue may have to do with the extensions on the files in your template folder. By default, Craft only renders <code>.html</code> and <code>.txt</code> files. If you want Craft to also render <code>.txt</code> files, you could update the <a href="https://craftcms.com/docs/config-settings#defaultTemplateExtensions" rel="nofollow noreferrer">defaultTemplateExtensions</a> config variable.  Adding something like this to your <code>general.php</code> would get <code>.txt</code> files rendering:</p>

<pre><code>'defaultTemplateExtensions' =&gt; array('html', 'twig', 'txt')
</code></pre>

<p>If you want to access a <code>.txt</code> file without enabling it as a <code>defaultTemplateExtension</code>, you would have to access the template URL with the full file extension.</p>

<p>This URL would work out of the box:</p>

<pre><code>/newsletter/entry.txt
</code></pre>

<p>This would only render <code>.html</code> or <code>.twig</code>:</p>

<pre><code>/newsletter/entry
</code></pre>

<p>These defaults makes it a little harder to use a hidden template file such as <code>newsletter/_entry</code> for non-standard extensions. One work around would be to pass your ID as a parameter in the URL and manually grab it in your template code to determine what to do on the page. </p>

<p>This is an option:</p>

<pre><code>/newsletter/entry.txt?id=123
</code></pre>

<hr>

<p>As an alternative method, the plugin <a href="http://sprout.barrelstrengthdesign.com/craft-plugins/email" rel="nofollow noreferrer">Sprout Email</a> helps manage a lot of components of HTML and Text versions of email templates, and ships with a <code>Copy/Paste Mailer</code> which allows a user to copy and paste the HTML and Text versions of an email directly from a modal in the the Control Panel.</p>

<p><a href="https://i.sstatic.net/MR7Ex.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MR7Ex.png" alt="enter image description here"></a></p>

CC BY-SA 3.0
2016-04-27T06:57:09.757Z
2016-04-27T06:57:09.757Z
Ben Parizek
<p>So I'm using Craft to create code to be pasted into a blast email program. My standard template is at the following:</p>

<pre><code>newsletter/_entry
</code></pre>

<p>However, I'm having trouble getting the text version to display in any way. I tried creating the following folder structure which did not work (404).</p>

<pre><code>newsletter/text/_entry
</code></pre>

<p>I tried using routes in the backend to do this, but does not work either. I know I must be missing something simple. Any ideas?</p>

CC BY-SA 3.0
2016-04-26T17:43:39.473Z
How are you planning to serve the text version?
mcclaskiem
<routes><routing>
Creating HTML and Text version of entry via different templates
# Creating HTML and Text version of entry via different templates

(Asked by: username_0 on 2016-04-26)

So I'm using Craft to create code to be pasted into a blast email program. My standard template is at the following:
newsletter/_entry

However, I'm having trouble getting the text version to display in any way. I tried creating the following folder structure which did not work (404).
newsletter/text/_entry

I tried using routes in the backend to do this, but does not work either. I know I must be missing something simple. Any ideas?

**Tags:** routes, routing

> **Comments:**
> **username_1**: How are you planning to serve the text version?  

---

## 1 answers

### Answer by username_2 on 2016-04-27. Score: 1

The issue may have to do with the extensions on the files in your template folder. By default, Craft only renders .html and .txt files. If you want Craft to also render .txt files, you could update the defaultTemplateExtensions config variable.  Adding something like this to your general.php would get .txt files rendering:
'defaultTemplateExtensions' => array('html', 'twig', 'txt')

If you want to access a .txt file without enabling it as a defaultTemplateExtension, you would have to access the template URL with the full file extension.
This URL would work out of the box:
/newsletter/entry.txt

This would only render .html or .twig:
/newsletter/entry

These defaults makes it a little harder to use a hidden template file such as newsletter/_entry for non-standard extensions. One work around would be to pass your ID as a parameter in the URL and manually grab it in your template code to determine what to do on the page. 
This is an option:
/newsletter/entry.txt?id=123


As an alternative method, the plugin Sprout Email helps manage a lot of components of HTML and Text versions of email templates, and ships with a Copy/Paste Mailer which allows a user to copy and paste the HTML and Text versions of an email directly from a modal in the the Control Panel.


---

