What is the best way to generate a sitemap? [closed]

感情迁移 提交于 2019-11-29 10:03:40

If your site architecture is contained in a database (like a CMS) you can do something like Darkyo suggested.

However there are easier methods. There are many free services which crawl your site and create a sitemap

http://www.xml-sitemaps.com/ or http://sitemapdoc.com/ are some examples but the Internet is full of them. Just google "sitemap creator".

If you want to create your own script there is program called "php sitemap ng" at http://enarion.net/google/phpsitemapng . This can be a real good starting place.

If you run a content based site (like YouTube for example), just write a small script that reads your database and generates an XML file for each URL.

Put it as a cron job once every day/week. You can also ping Google/Yahoo/MSN etc. when your sitemap gets updated so they can pick your new sitemap and index the new URL's.

It really depends of how is programmatically build your website, if your website is huge and reflects a db schema, the best thing is to write a friendly url generator and store it to the db.

Thank to this system you'll be able to manage retrieve your sitemap easilly

Select CONCAT("http://mysite.com/article/",article.friendly_url) from article 

But as I said it highly depends of your architecture / programming ....

Automatically is very hard. You can help though, by using correct semantics.

This will make Google pick up your site's structure better.

When your website consist of static pages you can create a sitemap yourself. If though it is generated with a database you can do this programmaticly. This won't be easy though if you have no experience.

If you use a CMS like Wordpress or Drupal or ... you probably can generate it with a plugin. Use Google for that!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!