|
|
|||
to hide the keywords and discriptions
]Hello,
I would like to know, how I could hide the keywords and discriptions in meta tags in HTML using PHP, that they will be hidden from the users but not from the search engines. Thanks 6 Replies
If you put the description and keyword meta tags in the head of the page they won't be displayed on the page, so users won't see them, but they will be accessible to search engines.
You page should be structured something like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta name="Keywords" content="Your Keywords Here" /> <meta name="Description" content="Your Description Here" /> <title>Your Title Here</title> </head> <body> Your Page Content Here </body> </html> I hope this helps!
You can't do that. A PHP page is actually being interpreted, an HTML page is being rendered. If it's on the HTML page then it's on the page. It will always be on the source page, it may be on the displayed/rendered page.
=========================
Sent to you from my iPad, iPhone, BlackBerry, Laptop, Desktop, or Kitchen Toaster
The only way I can think of doing it would be to use PHP to add them (or not) based on the headers sent, but it would potentially be very unreliable (I don't think there are standard headers used by search engine crawlers).
Something like: <html> <head> <title>Test Page</title> <?php if ($_SERVER['HTTP_USER_AGENT']=="some search engine crawler text") {?> <meta name="Keywords" content="various keywords"> <?php }?> ... Of course, they will be in the source page, but may or may not be in the page that the server serves depending on the headers sent by the requesting agent. I suppose another way might be to have every page loaded through a server script that removes the keywords if it recognizes the requesting agent and doesn't otherwise. So pages are loaded through urls like loadpage.php?page=main.html. Of course, there are speed issues, security issues (which can be fixed) and other problems with that. I would trust this method even less than the other. In both cases, you will probably need to be able to reliably identify user agents from the headers. |
|||
|