我试图找出一种方法来为每页创建描述和关键字。
对于标题,它将是:
{{title=some page title in here}}
对于描述,我会做这样的事情:
{{description=some description per page in here}}
同样对于关键字元标记,我会做这样的事情:
{{keywords=example keyword, per each page, this is an example}}
我将如何通过 preg_replace + regex 解析来实现这一点,所以它不会在它自己的页面上可见,而是放在实际的元信息中,例如:
<title> some page title in here </title>
<meta name="description" content="some description per page in here">
<meta name="keywords" content="example keyword, per each page, this is an example">
示例页面如下所示:
{{title=some page title in here}}
{{description=some description per page in here}}
{{keywords=example keyword, per each page, this is an example}}
<div id="content">
<h4> Some page title here </h4>
<p> Some page paragraphs here. </p>
</div> <!--#content-->
当然结果与此类似:
<html>
<head>
<title> Website Title - some page title in here </title>
<meta name="description" content="some description per page in here">
<meta name="keywords" content="example keyword, per each page, this is an example">
</head>
<body>
<div id="content">
<h4> Some page title here </h4>
<p> Some page paragraphs here. </p>
</div> <!--#content-->
</body>
</html>
非常感谢你的帮助。