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

4

11

I need to build a sitemap for my website. The url will be "www.example.com/mysitemap.html". I know that there are some tools that generate automatically an XML file that contains the reachable URLs and also improve the SEO.

So my questions are: How can I build this HTML page going from the generated XML? Or am I wrong and this kind of HTML page is built manually? If not, how do we integrate the XML and convert it to the website?

Thank you very much. Regards.

General answered 7/3, 2010 at 15:24 Comment(2)
It totally depends on what platform you work with, what scripting languages you can use and whether you use a CMS or not. That information would be helpful.Copula
I use php with a custom template system. Thanks.General
C
6

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.

Carper answered 7/3, 2010 at 15:58 Comment(1)
Best way if you are using Flask (PHP was not described early on, so Flask users may get here) is flask-sitemap.readthedocs.io/en/latestGlomerulonephritis
C
3

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.

Crucify answered 7/3, 2010 at 17:43 Comment(0)
B
1

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 ....

Bothwell answered 7/3, 2010 at 15:29 Comment(0)
A
0

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!

Alver answered 7/3, 2010 at 15:34 Comment(1)
Not very hard if you use Flask: flask-sitemap.readthedocs.io/en/latestGlomerulonephritis

© 2022 - 2024 — McMap. All rights reserved.