How to automatically show Title of the Entries/Articles in the Browser Title Bar in ExpressionEngine 2?

Posted by Ibn Saeed on Stack Overflow See other posts from Stack Overflow or by Ibn Saeed
Published on 2011-05-31T16:00:51Z Indexed on 2012/10/24 23:01 UTC
Read the original article Hit count: 180

Filed under:

How would I output the title of an entry in ExpressionEngine and display it in the browser's title bar?

Here is the content of my page's header:

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test Site</title>
    <link rel="stylesheet" href="{stylesheet=site/site_css}" type="text/css" media="screen" />
</head>

What I need is for each page to display the title of the entry in my browser's title bar — how can I achieve that?


Part of UPDATED Code:

Here is how i have done it :

{exp:channel:entries channel="news_articles" status="open|Featured Top Story|Top Story" limit="1" disable="member_data|trackbacks|pagination"}

{embed="includes/document_header" page_title=" | {title}"}

<body class="home">
<div id="layoutWrapper">
    {embed="includes/masthead_navigation"}
    <div id="content">
        <div id="article">
            <img src="{article_image}" alt="News Article Image" />
            <h4>{title}</h4>
            <h5><span class="by">By</span> {article_author}</h5>
            <p>{entry_date format="%M %d, %Y"} -- Updated {gmt_edit_date format="%M %d, %Y"}</p>                    
            {article_body}    
{/exp:channel:entries}
        </div>

What do you think?

© Stack Overflow or respective owner

Related posts about expressionengine