使用php动态添加meta标签
In my site I have a list of categories and I have to put meta keywords and description for them.I have a single page where I will retrieve the categories from the database.
Can anyone tell me how to make this much simpler to put meta tags for all the categories.
Regards,
Rekha
http://hiox.org
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这是否是您正在寻找的,但是...
我创建了一个简单的脚本,用于使用从数组中获取的随机关键字动态填充元关键字。
将其放入模板文件的标题中。
这将从关键字数组中创建一个以逗号分隔的不超过 10 个关键字的列表。如果您想避免每次都进行数据库查询,您可以为每个类别硬编码可能的关键字数组。如果您不介意查询,可以将数组替换为返回数组的查询。
希望这有帮助。
I'm not sure if this is what you are looking for but...
I have a simple script I created to dynamically populate the meta keywords with random keywords taken from an array.
Put this in the header of your template file.
This will create a comma delimited list of no more than 10 keywords from an array of keywords. If you wanted to avoid a database query each time you could hard-code arrays of possible keywords for each category. If you don't mind a query, you could replace the array with a query which returns an array.
Hope this helps.