forked from pawelantczak/php-sitemap-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple-example.php
39 lines (33 loc) · 1.39 KB
/
simple-example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
// include class
include 'SitemapGenerator.php';
// create object
$sitemap = new SitemapGenerator("http://your.app.com/");
// add urls
$sitemap->addUrl("http://your.app.com", date('c'), 'daily', '1');
$sitemap->addUrl("http://your.app.com/page1", date('c'), 'daily', '0.5');
$sitemap->addUrl("http://your.app.com/page2", date('c'), 'daily');
$sitemap->addUrl("http://your.app.com/page3", date('c'));
$sitemap->addUrl("http://your.app.com/page4");
$sitemap->addUrl("http://your.app.com/page/subpage1", date('c'), 'daily', '0.4');
$sitemap->addUrl("http://your.app.com/page/subpage2", date('c'), 'daily');
$sitemap->addUrl("http://your.app.com/page/subpage3", date('c'));
$sitemap->addUrl("http://your.app.com/page/subpage4");
// create sitemap
$sitemap->createSitemap();
// write sitemap as file
$sitemap->writeSitemap();
// update robots.txt file
$sitemap->updateRobots();
// submit sitemaps to search engines
$sitemap->submitSitemap();
?>
</body>
</html>