0

Although i asked about SEO for dynamic pages, and got right answer, I seriously forgot to mention the most important thing that i want to know.

Suppose i have following php line of code

<title><?php echo $title; ?></title>
<meta name="description" content="<?php echo $description; ?>" />
<meta name="keywords" content="<?php echo $keywords; ?>" />

where the variable represent the their values generated from a database. Now, there are two simple plain and stupid question i want to ask

  1. Will search engine crawl this dynamically generated page as a normal static page with these values static.

  2. I don't know for some reason i think search engine don't do. But for example, when ever i type some question, i get the answer on stackoverflow website. I think the questions and answers are stored in database but how does a search engine find the page and display the title and description of the page stored in page. Or is it that stackoverflow generates a static page for each and every question that can be edited.

regards

1
  • Indent 4 spaces or highlight and hit Ctrl+K to format a piece of code. Or if you want to include inline code, put backticks (`) around it. Nov 22, 2010 at 16:46

3 Answers 3

2

Methinks you need to learn a little more about how the internet works. When you request a URL from a server, the server returns a string of plain HTML. The server does not return PHP code. Your browser does not know whether the page is dynamically generated or served from a static file. It doesn't matter to them, they just want HTML to display. You get the same response either way.

So it follows that your PHP code: <title><?php echo $title; ?></title> isn't returned, but the PHP bit is replaced by the $title variable. So if the title is "Hello World", anyone requesting that page only sees <title>Hello World</title> in the HTML.

So to your questions:

  1. Yes, browsers and search engines alike only see HTML code.
  2. Yes, the content is stored in the database. But on every URL you visit on the site, SO generates a complete HTML page (often it will be cached but it makes no difference). Go to a page and view the source in your browser, you will see exactly the same as what search engines see.
3
  • Thank you ... and thanks to dave for answer. Would it be wrong if I say that the pages get indexed after they are opened by a browser. I mean if a page is never opened, the page gets never indexed. Am i right? this is the last of my confusion about SEO
    – S L
    Nov 22, 2010 at 15:54
  • 1
    @explorex: No, it doesn't matter if the page has been opened by a browser or not. That's not how dynamic pages work. The dynamic page is just a response to a particular URL/URI request. As long as there's a link to that URL and the web crawler knows that page exists, it will try to fetch the page, and it will get the dynamic response. It doesn't matter whether the search engine crawls the page before any humans click on the link. The web server doesn't care about that. It will parse the same code and send the same page regardless. Nov 22, 2010 at 16:42
  • Simplifying a bit: A crawler or spider is just like any regular internet user who receives pages with a browser, clicks on links and receives other pages. Anything that a user can browse to a crawler can. Treating crawlers differently (something you can force) is actually bad and may lead to you site being penalized.
    – Omar Kohl
    Nov 23, 2010 at 16:39
1

I think you already have your answer on your previous SEO question.

But let's go for your anwsers:

  1. Yes, search engines cannot really determine from where data it is seem came. They see only plain HTML. What they see is what they index. To have a better idea, just look at the generated HTML source code. That is what crawlers see and process. Nothing further.

  2. This is a valid example for your question. But keep in mind that only in a few cases the title tag is changed. In articles it is even more rare the title change. Also we all avoid changing title. When this happen, happen at most just once.

Hope you got the points.

-1

If you ever wonder what a search engine will "see," turn off JavaScript, open a website, right click, and select "View Source" (or something along those lines).

1
  • Or you can just use CTRL+U. Nov 22, 2010 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.