Let's say I've got all of my pages laid out like

root/page.php combined with root/content/page.php

page.php includes:

  • header.php
  • footer.php
  • sometemplate.php
  • menu.php
  • submenu.php
  • /content/page.php

This way the only thing generally in the /content/page.php is very basic html markup and the copy.

For my sitemap would I list http://www.root.com/page.php or http://www.root.com/content/page.php?

  • 1
    You index whatever the visitor is viewing and not by-parts of your template. Footer, Header, Menu, Submenu etc should not be accessible directly by navigating to those files, but rather so index.php or page.php. You shouldn't need to even think about those files if you have correctly made those files by using good PHP practices. – Simon Hayter Oct 15 '15 at 18:47
  • @SimonHayter ---- Thanks, thats what I figured just wasn't sure on the content since its the part that actually gets changed, any reason you left that as a comment instead of an answer? – Ryan Oct 15 '15 at 19:00
  • I normally leave a comment if I don't have time to write a better quality answer, anyhows, made time and there you go :) thanks. – Simon Hayter Oct 15 '15 at 19:43

You should index whatever the visitor is viewing and not internal by-parts of your template.

Files such as footer.php, header.php, nav.phpare commonly called using PHP Include, because of the nature of the way PHP includes work, the visitor doesn't see any of these files but rather a complete render of all parts, it is the final outcome that you should want to index.

Using good PHP practices your php template files should not be directly accessible, so even if you did include them in your sitemap, Google and other search engines would not index those pages, because the server should be returning a valid server-side response with either a 404 not found, or 403 forbidden.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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