Php 表达式引擎CMS如何动态填充元标记?

Php 表达式引擎CMS如何动态填充元标记?,php,seo,expressionengine,meta,Php,Seo,Expressionengine,Meta,我正在尝试为我的表达式引擎网站添加描述和关键字的元标记 我的结构是: 我有一个{top}片段,它在每个模板中都被调用 在头牌里面我有这个 <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="{exp:channel:entries}{blog_seo_descrip

我正在尝试为我的表达式引擎网站添加描述和关键字的元标记

我的结构是: 我有一个{top}片段,它在每个模板中都被调用

在头牌里面我有这个

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{exp:channel:entries}{blog_seo_description}{/exp:channel:entries}">
<meta name="author" content="http://epicsoftware.com" >
<meta name="keywords"  content="{blog_seo_keywords}" />
{if segment_1 == ""}
<title>Epic Software Group, Inc.</title>
{if:else}
{exp:channel:entries channel="main|blog|projects" limit="1" disable="categories|category_fields|custom_fields|member_data|pagination"}
<title>Epic Software Group, Inc. - {title}</title>
{/exp:channel:entries}
{/if}

{如果段_1==“”}
史诗软件集团公司。
{if:else}
{exp:channel:entries channel=“main | blog | projects”limit=“1”disable=“categories | category |字段|自定义|字段|成员|数据|分页”}
Epic软件集团有限公司{title}
{/exp:channel:entries}
{/if}
当我为一个页面编写描述时,它在所有地方都应用了相同的描述,我认为这是因为最上面的片段不知道信息来自哪里。 此外,我无法在“其他频道字段”组中创建另一个同名频道字段

我需要为每个频道创建一个频道字段,并在meta标记中显示该频道条目的信息


Expression Engine版本:2.11.2

通过使用布局,您可以更轻松地执行此操作: 基本上,您将拥有一个包含基本模板的包装器模板,并将另一个模板的内容提供给此模板。 这样,您只需使用channel:entries标记一次即可设置所有数据。 这是我设置变量的基本模板:

{layout="_partials/_wrapper"}
{exp:channel:entries 
 channel="pages" 
 disable="categories|pagination|member_data|relationships"}
{layout:set name="extra_header_content"}<script src="/assets/js/my_extra_script.js">{/layout:set}
{layout:set name="browser_title"}{browser_title}{/layout:set}
{layout:set name="seo_description"}{seo_description}{/layout:set}
{layout:set name="page_title"}{page_title}{/layout:set}
{layout:set name="body_content"}{body_text}{/layout:set}
{/exp:channel:entries}
在博客或新闻中的每个模板中,您可以使用{layout=“\u partials/\u wrapper”}嵌入相同的包装器模板,因为它只需要模板组/模板名称作为输入


如果您需要更多帮助,请直接前往获取更具体的EE建议

谢谢您的时间。我很难弄清楚模板布局应该放在哪里,结构应该放在哪里。我应该在同一个模板组中创建一个名为layout的新模板吗?{layout=“sub/blog”}{exp:channel:entries channel=“pages”disable=“categories | category | fields | custom | fields | member | data | pagination”}{layout:set name=“seo | description”}{blog(seo)描述}{/layou set:set}{/exp channel entries}{/blog:set}{/?再次感谢你
<!doctype html>
<html class="no-js" lang="nl" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{layout:browser_title}</title>
<meta name='description' content='{layout:seo_description}' />
<meta name="twitter:description" content="{layout:seo_description}" />
<meta property="og:description" content="{layout:seo_description}">
{layout:extra_header_content}
</head>
<body>
<h1>{layout:page_title}</h1>
{layout:body_content}
</body>
</html>
{layout="_partials/_wrapper"}
{preload_replace:channel="pages"}
{exp:channel:entries 
 channel="pages" 
 disable="categories|pagination|member_data|relationships"}
{layout:set name="extra_header_content"}<script src="/assets/js/my_extra_script.js">{/layout:set}
{layout:set name="browser_title"}{{channel}_browser_title}{/layout:set}
{layout:set name="seo_description"}{{channel}_seo_description}{/layout:set}
{layout:set name="page_title"}{{channel}_page_title}{/layout:set}
{layout:set name="body_content"}{{channel}_body_text}{/layout:set}
{/exp:channel:entries}
_partials
    -_wrapper
    -_another_template
    -_some_other_template
blog
    -index
    -item
news
    -index
    -item