How to automatically display the title / article in the browser title bar in ExpressionEngine 2?

How can I display the title of an entry in ExpressionEngine and display it in the browser title bar?

Here is the content of the title of my page:

<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>

I need each page to display the post title in my browser title bar - how can I achieve this?


Part of the updated code:

Here is how I did 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?

+3
source share
4 answers

If you want to show only the name of your ExpressionEngine site (as defined in CP Home> Admin> General Configuration), use the global site name variable :

<title>{site_name}</title>

, :

<title>
    {exp:channel:entries channel="channel_name" limit="1" dynamic="yes"}
        {title}
    {/exp:weblog:entries}
</title>

- , ` {entry_title} , :

{embed="includes/header" title="{exp:channel:entries channel="{channel_name}"}{title}{/exp:channel:entries}"}

EE2, SEO Lite :

<html lang="en">
<head>
    <meta charset="utf-8" />
    {exp:seo_lite url_title="{url_title}"}
</head>

Low Title Plugin (EE1, EE2).

+6

- "" . , "" - . , , , . , , :

EE ,

{embed="embeds/.inside-wrapper"}

{exp:channel:entries channel="channel_name" limit="1" dynamic="yes" disable="whatever|you|can|live|without"}

{!-- ENTRY SEO META DATA --}
{exp:stash:set name="entry_seo_title" scope="site"}{cf_channelprefix_seo_title}{/exp:stash:set}
{exp:stash:set name="entry_seo_description" scope="site"}{cf_channelprefix_seo_description}{/exp:stash:set}
{exp:stash:set name="entry_seo_keywords" scope="site"}{cf_channelprefix_seo_keywords}{/exp:stash:set}

{!-- ENTRY/PAGE CONTENT --}
{exp:stash:set name="entry_body_content" parse_tags="yes" parse_conditionals="yes" scope="site"}
Your page content here
{/exp:stash:set}

{/exp:channel:entries}

, HTML-, . - , -, :

<html>
<head>
<title>{exp:stash:get name="entry_seo_title"}</title>
<meta name="description" content="{exp:stash:get name="entry_seo_description"}" />
<meta name="keywords" content="{exp:stash:get name="entry_seo_keywords"}" />
</head>

<body>

{exp:stash:get name="entry_body_content"}

</body>
</html>
+8

Ryan (, , ): , {exp:channel:entries} , ( ) : . :

{exp:channel:entries channel="channel_name" limit="1"}
    {embed="includes/header" title="{title}"}
    <h1>{title}</h1>
    {page_content}
    {embed="includes/footer"}
    {if no_results}{redirect="404"}{/if}
{/exp:channel:entries}
+2

NSM Better Meta - .

String.

https://devot-ee.com/add-ons/string

.

+2

All Articles