Implementing titles in ExpressionEngine

Implementing the title element in your ExpressionEngine templates is easy once you’re getting more familiar with the EE tags. For those still learning the first steps in EE, this will help you creating nice dynamic titles. I also share a tip on how to avoid a messy title bar in case the URL is broken. Learn and enjoy! 😉

Assign a variable

First thing you need to do is assigning a variable to your weblog’s name. This will make things easy if you want to (re)use this name in your template.

Implementing titles in Expression Engine - Assign a variable

The name of my (main) blog is “veerle_blog”. So I assign the variable “my_weblog” to this name. Everywhere I use the variable “my_weblog” in the EE tags, EE will know that I’m referring to my main blog, “veerle_blog”.

Implementing the EE title element

Between the opening and ending tag I’ve placed the following EE tags:

Implementing the EE title element

Let me clarify this. If you look at the titles of my pages, you’ll see it’s divided into 2 parts: the name of the blog and the title of the article separated by a pipe. In the first part I call the “weblog:info” tag where I use the variable “blog_title” which will display the “Full Weblog Name” name. In the second part I call the “weblog:entries” tag where I use the “title” variable which refers to the title of the article.

Avoiding messy title bars

A while ago I added an extra parameter to solve the layout errors when someone doesn’t enter the full URL or if the URL got broken. This was simply done by adding require_entry=”yes” in each EE exp weblogs:entries tag.

Implementing titles in ExpressionEngine - Avoiding messy title bars

If you don’t use this parameter, things will get messy in the title bar of the browser if the URL is broken. Adding this parameter solves the issue.

Speak Your Mind