更改PHP网站中每个页面的metas

问题描述 投票:1回答:3

看一下这个:How to make webpages with the same design。我用它来建立一个名为X Phoenix的网站。当我在Google上输入X Phoenix时,虽然我已经将它放置在google网站管理员上,但它并没有排在首位,已经有4个月了。我在Google搜索上看不到任何地方。在this pdf上,所有页面都使用了不同的关键字,标题和描述。但是在我的网站上,我使用了一种方法,将头和身体中的其他一些东西放在一个名为header.php的文件中,并将东西放在我的footer.php中,然后放在ex的页面中。 home.php,我输入:

<?php include('header.php'); ?>
my text
<?php include('footer.php'); ?>

我的metas在标题中,因此我该如何在每个页面中进行更改。如何编写关键字,例如xphoenix,x,phoenix,f1等。还告诉我其他使我的网站在Google之上并使它看起来更好的方法。请给我一些有关站点地图的信息以及如何制作它们。如果我的名字是:team x phoenix,我应该在关键字中写team,x,phoenix还是team x phoenix。

php html web meta-tags meta
3个回答
9
投票

例如,您可以这样做:

在您的home.php中

$meta1 = 'My meta tag text';
include('header.php');
echo 'my text';
include('footer.php');

在header.php中,您可以这样做:

<meta name="description" content="<?php echo $meta1; ?>">
  • 对于seo,您可以检查此链接:SEO
  • 对于站点地图生成器,您可以在这里查看:Sitemap

但是我认为最好只使用google。


3
投票

您可以通过以下方法在每个页面上定义不同的元标记:

$meta['keywords'] = "Keyoword, more words, ...";
$meta['description'] = "...";
<?php include('header.php'); ?>
my text
<?php include('footer.php'); ?>

并且在header.php文件内可以对您定义的所有不同元标记执行此操作:

<meta name="keywords" content="<?php echo $meta['keywords']; ?>" />
<meta name="description" content="<?php echo $meta['description']; ?>" />
...

0
投票

根据我的经验,我将元描述和关键字分别在数据库中存储到包含它的页面。然后我将其动态地称为标题。

- page_id             int(11) auto increment
- page_title          varchar(250)  Not Null
- name                varcar(250)  Not Null
- meta_description    text
- meta_keywords       text
- is_published        tinyint(1)  Not Null
- is_deleted          tinyint(1)  Not Null
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.