Click to See Complete Forum and Search --> : SEO With PHP


Joseph Witchard
01-17-2009, 11:33 PM
The way I have my page set up, none of the HTML even gets output unless the information is successfully pulled out of the database (all of the PHP code is above the doctype declaration). However, as there's always going to be something in my database, I don't see this as a problem.

Is that method going to confuse search engines?

chazzy
01-18-2009, 12:33 PM
do you have robots.txt? sitemap.xml ?

Charles
01-18-2009, 01:02 PM
Search engines don't care or know what's going on server side--unless you tell them. It doesn't matter how you are generating the pages all that matters is the page, its headers and associated things like the aforementioned robots.txt and sitemap.xml files. However, it is an immutable principal of engineering that everything always goes wrong somehow. Give your routine a default something or another for when the data base does come up empty.

Joseph Witchard
01-18-2009, 02:23 PM
I don't know what a robots.txt file is or does. And I haven't really gotten my hands dirty with XML yet. Is designing a site map easy enough to do without having already studied XML thoroughly?

Charles
01-18-2009, 02:27 PM
See http://www.robotstxt.org/ & http://www.sitemaps.org/ . If you know HTML you can figure out XML. If you know XHTML then you already know XML...but far fewer know XHTML than think that they do,

Joseph Witchard
01-18-2009, 02:42 PM
Thanks to whoever moved this thread:)

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

What exactly is that? I read about it on the link you gave me, but I still didn't understand.

Charles
01-18-2009, 05:41 PM
It's a start tag for the element "urlset" having the attribute "xmlns" with the value of "http://www.sitemaps.org/schemas/sitemap/0.9". That particular attribute defines the namespace. The point of XML is to allow the mixing and expanding of mark up languages. That declaration makes that element really an "http://www.sitemaps.org/schemas/sitemap/0.9:urlset". That way you can add other elements with your own namespace that might make your file more useful to you or somebody but that will be ignored by the search engines.

Joseph Witchard
01-18-2009, 05:46 PM
It's a start tag for the element "urlset" having the attribute "xmlns" with the value of "http://www.sitemaps.org/schemas/sitemap/0.9". That particular attribute defines the namespace. The point of XML is to allow the mixing and expanding of mark up languages. That declaration makes that element really an "http://www.sitemaps.org/schemas/sitemap/0.9:urlset". That way you can add other elements with your own namespace that might make your file more useful to you or somebody but that will be ignored by the search engines.

So if my site was called example.com, would I make mine "http://www.example.com/schemas/sitemap/0.9"? Sorry, I'm just really confused.

Charles
01-19-2009, 07:20 AM
So if my site was called example.com, would I make mine "http://www.example.com/schemas/sitemap/0.9"? Sorry, I'm just really confused.That would change the http://www.sitemaps.org/schemas/sitemap/0.9:urlset element into http://www.example.com/schemas/sitemap/0.9:urlset which search engines will not recognize and will ignore. Leave that namespace declaration alone.

Lets say you get your sitemap.xml page done. You've done a lot of work and it might just be something useful to humans searching for things on your site. There is a way to make XML files display nice on a browser with what are called XSLT stylesheets. So you write a stylesheet that gets the sitemap looking like the rest of your site and everything is good until you realize that you would like to add some more information about each file. The Dublin Core metadata comes to mind. See http://www.w3schools.com/rdf/rdf_dublin.asp . Your sitemap might then look like:<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:dc="http://purl.org/dc/elements/1.1/">
<url>
<loc>http://www.example.com/</loc>
<lastmod>2005-01-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
<dc:title>Some Pig</dc:title>
</url>
</urlset> Your stylesheet can now pick up the title and the search engines just ignore it--or not. The reason you use the Dublin Core and not your own made up namespace is that the Dublin Core is widely known and controlled. Search engines are going to know what dc:title means, but only because they have replaced the "dc" with the url supplied above, and so they might make use of this information.

Joseph Witchard
01-20-2009, 02:17 AM
Okay, so the <urlset> needs to be specified by those standards, right? You don't customize it any for your site, because search engines follow what's in those specific links (sitemaps.org and purl.org)?

Charles
01-20-2009, 05:57 AM
Exactly. If in doubt, and even if not, Google has a sitemap validator somewhere in there.

Joseph Witchard
01-24-2009, 11:57 PM
Does the XML file need to be included in your other pages, or does it just need to be stored on your server (giving the URL to search engines you're submitting it to, of course)?

Also, my site is already listed on search engines, but I've never had a sitemap; I just gave them the homepage URL. Don't search engines get irritated with your site if it's submitted to them more than once?

Charles
01-25-2009, 01:04 PM
Set up an account with Google and then once you sign in one of the links will be for 'Webmaster tools" or something like that. There you will find more intricate instructions and a way to submit your sitemap.

Joseph Witchard
01-25-2009, 11:29 PM
Thank you so much:)