diff --git a/README.md b/README.md index 2d86c82..d62563c 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,9 @@ $sitemap->addItem('http://example.com/mylink2', time()); $sitemap->addItem('http://example.com/mylink3', time(), Sitemap::HOURLY); $sitemap->addItem('http://example.com/mylink4', time(), Sitemap::DAILY, 0.3); +// set sitemap stylesheet (see example-sitemap-stylesheet.xsl) +$sitemap->setStylesheet('http://example.com/css/sitemap.xsl'); + // write it $sitemap->write(); @@ -62,6 +65,9 @@ $staticSitemap->addItem('http://example.com/about'); $staticSitemap->addItem('http://example.com/tos'); $staticSitemap->addItem('http://example.com/jobs'); +// set optional stylesheet (see example-sitemap-stylesheet.xsl) +$staticSitemap->setStylesheet('http://example.com/css/sitemap.xsl'); + // write it $staticSitemap->write(); @@ -71,7 +77,7 @@ $staticSitemapUrls = $staticSitemap->getSitemapUrls('http://example.com/'); // create sitemap index file $index = new Index(__DIR__ . '/sitemap_index.xml'); -// set stylesheet +// set index stylesheet (see example in repo) $index->setStylesheet('http://example.com/css/sitemap.xsl'); // add URLs @@ -119,6 +125,9 @@ $sitemap->addItem([ 'en' => 'http://example.com/en/mylink4', ], time(), Sitemap::DAILY, 0.3); +// set stylesheet (see example-sitemap-stylesheet.xsl) +$sitemap->setStylesheet('http://example.com/css/sitemap.xsl'); + // write it $sitemap->write(); @@ -140,13 +149,13 @@ There are methods to configure `Sitemap` instance: - `setUseIndent($bool)`. Sets if XML should be indented. Default is true. - `setUseGzip($bool)`. Sets whether the resulting sitemap files will be gzipped or not. Default is `false`. `zlib` extension must be enabled to use this feature. -- `setStylesheet($string)`. Sets the `xml-stylesheet` tag. By default, tag is not generated. +- `setStylesheet($string)`. Sets the `xml-stylesheet` tag. By default, tag is not generated. See example [example-sitemap-stylesheet.xsl](/example-sitemap-stylesheet.xsl) There is a method to configure `Index` instance: - `setUseGzip($bool)`. Sets whether the resulting index file will be gzipped or not. Default is `false`. `zlib` extension must be enabled to use this feature. -- `setStylesheet($string)`. Sets the `xml-stylesheet` tag. By default, tag is not generated. +- `setStylesheet($string)`. Sets the `xml-stylesheet` tag. By default, tag is not generated. See example [example-sitemap-stylesheet.xsl](/example-sitemap-stylesheet.xsl) Running tests ------------- diff --git a/example-sitemap-stylesheet.xsl b/example-sitemap-stylesheet.xsl new file mode 100644 index 0000000..cac84b8 --- /dev/null +++ b/example-sitemap-stylesheet.xsl @@ -0,0 +1,157 @@ + + + + + + + XML Sitemap + + + + +
+

XML Sitemap

+

+ This is an XML Sitemap, meant for consumption by search engines.
+ You can find more information about XML sitemaps on sitemaps.org. +

+

+ This XML Sitemap has been generated using using the PHP package samdark/sitemap.
+ Release Version  + Tests  + Packagist PHP Version Support  + + Monthly Downloads  + Total Downloads  + License  +

+
+ +

+ This XML Sitemap Index file contains sitemaps. +

+ + + + + + + + + + + + + + + + + + +
SitemapLast Modified
+ + + +
+
+ +

+ This XML Sitemap contains URLs. +

+ + + + + + + + + + + + + + + + + + + +
URLImagesLast Mod.
+ + + + + + + + + + +
+
+
+ + +
+
+