lucamenozzi / sitemapper by lucamenozzi

Ridiculously small package for manual sitemap generation in small websites
33
0
1
Package Data
Maintainer Username: lucamenozzi
Maintainer Contact: info@apertagraffa.it (Luca Menozzi)
Package Create Date: 2016-05-10
Package Last Update: 2016-05-10
Language: PHP
License: MIT
Last Refreshed: 2024-04-12 03:00:28
Package Statistics
Total Downloads: 33
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

Manual sitemap generator

Laravel 5.2 Package to generate hand-write sitemap (only for small websites)

Synopsis

Sitemapper create a static sitemap in real time when requested via /sitemap.xml URI.

Obviously, this package is for small website only: if you have 100 pages, this strategy is wrong.
But for your personal website or for your blog, maybe you could give it a chance.

Installation

  • add "apertagraffa/sitemapper": "*" to your composer.json
  • create a get route to sitemap.xml: you can both use a callback in the route, but the best approach is to connect a controller method (to SitemapController, for example).

API Reference

You have only two methods, for now, you can't make mistakes :)

  • $sitemap->addUrl($location, $lastmod = null, $changefreq = null, $priority = null) : add a node to xml sitemap tree. $location is the needed static url, other parameters are optional;
  • $sitemap->render(): create the final sitemap tree.

You can then

               ->header('Content-Type', 'text/xml');```


## Behaviour
The real time response works only if NOT EXISTS a physical sitemap.xml file in root.
If it exists, will be returned.

That's all folks!