<p>Craft can render html yes... it's a pretty core element of it lol. </p>

<p>By flat do you mean completely non-dynamic?
Normally "flat html" means to just use "html" files and not rely on any sort of dynamic system like a CMS.</p>

<p>Or do you mean to flatten the code? As in to minify it? In which case craft can do that yes. <code>{% spaceless %}&lt;html&gt;     &lt;/html&gt;{% endspaceless %}</code> will become <code>&lt;html&gt;&lt;/html&gt;</code></p>

<p>On top of that it does have its own <a href="http://buildwithcraft.com/docs/templating/cache" rel="nofollow">{% cache %} tags</a> too (which definitely speeds things up), again you will need to wrap the appropriate cache tags around the bits of your site you want to cache.</p>

<p>Also be wary of cloudfront, it doesn't always speed things up, sometimes can make websites run slower. Though it does offer DDOS protection.</p>

CC BY-SA 3.0
2015-09-11T17:03:40.590Z
`cache` tags FTW!
Lindsey D
CC BY-SA 3.0
2015-09-11T14:33:37.640Z
2015-09-11T15:59:21.303Z
2015-09-11T15:59:21.303Z
joep
<blockquote>
  <p>I've come to understand that if Craft CMS can render flat html or cache some of the pages then it makes thing a lot quicker to load</p>
</blockquote>

<p>I believe you're looking for the the <a href="http://buildwithcraft.com/docs/templating/cache" rel="nofollow"><code>{% cache %}</code></a> tag, which will – on the first page request – capture the compiled HTML output inbetween the opening and closing of the tag, and write it to the database. On subsequent requests, Craft will pull and output the compiled (flat) HTML using a single SQL query (until the cache expires, is cleared manually or any entries, categories etc. involved is changed). This means that for most pageloads, complex database queries or taxing PHP operations (Twig templates are compiled to PHP) can be eliminated, which is usually a performance boost.</p>

<blockquote>
  <p>will it will be ok using assets from a cloud front CDN setup too?</p>
</blockquote>

<p>Yep, Craft is easily set up with external asset sources, and S3/CloudFront is supported. You will need a Craft Pro license, though.</p>

CC BY-SA 3.0
2015-09-13T23:08:03.103Z
Great answer; minor nitpick: S3 and CloudFront are 2 different services (as much as Amazon would like you to use both). You don't need to host your assets on S3 (anymore unless you want) to take advantage of CloudFront and you don't need a Craft Pro account to use any CDN (assuming the CDN supports using origin pull) since every Craft version supports external assets.
RitterKnight
CC BY-SA 3.0
2017-06-20T21:44:02.420Z
The cache tag is definitely a step in the right direction, but it still introduces a not-insignificant delay by bootstrapping Yii and Craft. The way around that is to use a static file cache as mentioned in this thread: https://craftcms.stackexchange.com/a/14681/5437
Simon East
CC BY-SA 3.0
2015-09-13T19:10:39.110Z
2015-09-13T19:10:39.110Z
Mats Mikkel Rummelhoff
<p>Having spoken to our 'ops guy' I've come to understand that if Craft CMS can render flat html or cache some of the pages then it makes thing a lot quicker to load etc.</p>

<p>Is this something craft can do? Also will it will be ok using assets from a cloud front CDN setup too?</p>

CC BY-SA 3.0
2017-06-20T21:40:00.113Z
It seems this question was asked previously, so you might find some advice there: [Are there any file-based static cache options for Craft CMS?](https://craftcms.stackexchange.com/questions/10241/are-there-any-file-based-static-cache-options-for-craft-cms)
Simon East
CC BY-SA 3.0
2017-06-20T22:08:55.130Z
@SimonEast Despite the similarities, I believe these two people are actually asking about different things. This seems clear based on their (very different) accepted answers. One poster is specifically looking for flat-file caching, the other is looking for flat files "or something", and is quite happy with a non-file solution.
Lindsey D
<cache>
Can Craft or any of its plugins render down flat html files for speed
# Can Craft or any of its plugins render down flat html files for speed

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

Having spoken to our 'ops guy' I've come to understand that if Craft CMS can render flat html or cache some of the pages then it makes thing a lot quicker to load etc.

Is this something craft can do? Also will it will be ok using assets from a cloud front CDN setup too?

**Tags:** cache
> **Comments:**
> **username_1**: It seems this question was asked previously, so you might find some advice there: [Are there any file-based static cache options for Craft CMS?](https://craftcms.stackexchange.com/questions/10241/are-there-any-file-based-static-cache-options-for-craft-cms)  
> **username_2**: @SimonEast Despite the similarities, I believe these two people are actually asking about different things. This seems clear based on their (very different) accepted answers. One poster is specifically looking for flat-file caching, the other is looking for flat files "or something", and is quite happy with a non-file solution.  

---

## 2 answers

### Answer by username_4 on 2015-09-13. Score: 4 | Accepted answer

> I've come to understand that if Craft CMS can render flat html or cache some of the pages then it makes thing a lot quicker to load

I believe you're looking for the the [`{% cache %}`](http://buildwithcraft.com/docs/templating/cache) tag, which will – on the first page request – capture the compiled HTML output inbetween the opening and closing of the tag, and write it to the database. On subsequent requests, Craft will pull and output the compiled (flat) HTML using a single SQL query (until the cache expires, is cleared manually or any entries, categories etc. involved is changed). This means that for most pageloads, complex database queries or taxing PHP operations (Twig templates are compiled to PHP) can be eliminated, which is usually a performance boost.

> will it will be ok using assets from a cloud front CDN setup too?

Yep, Craft is easily set up with external asset sources, and S3/CloudFront is supported. You will need a Craft Pro license, though.

> **Comments:**
> **username_5**: Great answer; minor nitpick: S3 and CloudFront are 2 different services (as much as Amazon would like you to use both). You don't need to host your assets on S3 (anymore unless you want) to take advantage of CloudFront and you don't need a Craft Pro account to use any CDN (assuming the CDN supports using origin pull) since every Craft version supports external assets.  
> **username_1**: The cache tag is definitely a step in the right direction, but it still introduces a not-insignificant delay by bootstrapping Yii and Craft. The way around that is to use a static file cache as mentioned in this thread: https://craftcms.stackexchange.com/a/14681/5437  

---

### Answer by username_3 on 2015-09-11. Score: 2

Craft can render html yes... it's a pretty core element of it lol.

By flat do you mean completely non-dynamic?
Normally "flat html" means to just use "html" files and not rely on any sort of dynamic system like a CMS.

Or do you mean to flatten the code? As in to minify it? In which case craft can do that yes. `{% spaceless %} {% endspaceless %}` will become

On top of that it does have its own [{% cache %} tags](http://buildwithcraft.com/docs/templating/cache) too (which definitely speeds things up), again you will need to wrap the appropriate cache tags around the bits of your site you want to cache.

Also be wary of cloudfront, it doesn't always speed things up, sometimes can make websites run slower. Though it does offer DDOS protection.

> **Comments:**
> **username_2**: `cache` tags FTW!  

---

