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

前端 未结 4 898
小蘑菇
小蘑菇 2021-01-03 09:12

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:

&l         


        
4条回答
  •  天涯浪人
    2021-01-03 10:11

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

    {site_name}

    If you want to display just the current entry title from a given channel use the following:

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

    Many Web Developers will use an Embed Variable with an Embedded Template to pass the `{entry_title} to a global embed template, allowing for a dynamic page title:

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

    If you're using EE2, the SEO Lite Module takes care of all the hard work for you with a single line of code:

    
    
        
        {exp:seo_lite url_title="{url_title}"}
    
    

    Other solutions include the Low Title Plugin (EE1, EE2).

提交回复
热议问题