【发布时间】:2014-12-19 15:19:04
【问题描述】:
我正在尝试从 p 元素中获取内容作为元描述。 我试图适应我在这里找到的东西,但没有运气。 Show content from DIV in a META-tag 我拥有的是一堆包含页眉和页脚的 .php 文件。
<?php
$title="Page title";
include_once("/includes/header.php");
?>
<div class="container">
<p>This content i want in meta description and it's different in each php file.</p>
</div>
<?php
include_once("/includes/bottom.php");
?>
我想要实现的是为我拥有的每个 .php 页面提供不同的元描述,而无需编辑数百个文件(就像我已经对标题所做的那样......)但基于该段落中的内容,我可以使用脚本添加到我的 header.php 中。
我试图尽可能清楚地说明这一点。提前感谢您的帮助。 编辑 我想要那个描述在 header.php 中
<meta name="description" content="This is where i want that description" />
【问题讨论】:
-
元描述在哪里?在
<meta>标头中?