While designing/developing a website with ExpressionEngine, its an important concern to have an optimized website to reduce the page load time. Here, I am sharing 10 tips to optimize an ExpressionEngine website.

1) De-install/remove unused add-ons(modules, extension, plugin, accessories) and templates (snippets & global variable), channels/weblogs, category group etc.

2) Practice to use disable parameter within channel entry tag. While using channel entry tag ({exp:channel:entries}), the system loads all the data/related data of the channel entry and one can disable few data which aren’t necessary anymore like:

  • Categories
  • Category Fields
  • Member Data
  • Pagination
  • Trackbacks

{exp:channel:entries
channel="channel_name"
limit="10"
disable="categories|category_fields|member_data|custom_fields|pagination|trackbacks"}
{title}
{body}
{/exp:channel:entries}

3) If you are using Query module for writing sql queries, write well optimized queries to fetch only necessary records.

4) Avoid to use so many embeds into a template as embeds take more time for processing than snippets or global variables.

Also, don’t save templates as file if not necessary. It adds extra overhead.

5) If any template is populating so many data/dynamic contents, use Template Caching (It can be enabled from Preferences -> Enable caching? by having Refresh Interval).

You can use following add-ons for caching:

ExpressionEngine, itself provides some more caching solutions like Queries Caching (Admin -> Channel Administration -> Global Preferences -> Cache Dynamic Channel Queries?) and Tag Cache. You must see more about Optimizing ExpressionEngine.

6) Avoid to inclule JS code or file within a template/page which is not neccessary. Mostly we create a common template/snippet for the head section of the page and it’s being embedded into main template {embed=“includes/header”} and keep including the JS even not being used for some pages.

We can make HTML structure better with:

{embed=“includes/header“}

< include JS which is necessary for that template/page />

[page content]

You can use Minimee to minimize and cache your CSS and JS files.

7) Avoid to use so many if and if:else conditions into a template. Instead of it switch can be used with the help of Switchee plugin.

8) There is tracking feature in ExpressionEngine. Some trackings can be disabled if not necessary. Tracking can be disabled from Control Panel -> Admin -> Security and Privacy -> Tracking Preferences.

9) Enable GZIP: GZIP can be enabled from Control Panel -> Admin -> System Administration -> Output and Debugging.

See How gzip compression works.

10) Avoid to use of excessive PHP code into a template. Instead of using PHP code into template, you should develop plugin to populate the data.