An easy way to add Page Titles in Expression Engine

A quick and simple way to add page titles to your EE site pages.

I've seen this time and time again in the EE forums. How in the heck do I add a page title to my weblog entries? Well, its easier than you think.

I like to use EE embeds for my HTML head content, so in my head template that I'll use for template includes (e.g. {embed="includes/.head}"), so in between my

<title>...</title

tags, I'll add something like:

   {embed:my_page_title} | My Site Name
  

Then in my template, depending if its a section landing page (For example, a template group's index template), an article, or general site page I do something like this:

    {exp:weblog:entries limit="1" weblog="{my_weblog}" disable="trackbacks|pagination|member_data|custom_fields|category_fields|categories"}
        {embed="includes/head" pagetitle="{title}")
    {/exp:weblog:entries} 
    

or this:

   {embed="includes/head" pagetitle="Section Title"}
  

And that's it! Now, wasn't that easy?

Filed in: Expression Engine    |    Posted on: June 25, 2010    |    (0) Comments  →  Add yours

Add a comment

But please keep you comments clean and on topic. And yes, you can use basic HTML.

Commenting is not available in this weblog entry.