Hello bards! It took me a long time to write this, but now it's finally here. In this post I will show you how to install and use the package that I have created called Bard for easily creating sitemaps.

Bard

Bard is framework agnostic package meaning that you can use it in plain PHP file on your server and it will just work. In this post I will show you how to use Bard with Laravel to create a sitemap for your website or web application. Bard is compatible with every version of Laravel and other PHP frameworks.

Bard can create a single sitemap or create a sitemap index. I'll show you how to create a single sitemap, since in most cases this is what you will want.

Sitemap common practice

After creating many sitemaps in Laravel I started to notice a pattern of what I usually do every time I start adding URL's to the sitemap. I add static pages like: home, about, location and then the dynamic pages for whatever I have like: trips, real estates, accommodations, apartments etc. Because I mainly create multilingual sites and applications I always add translations for specific URL. Let's say you have http://domain.com/about and then you want to include http://domain.com/hr/about to point to that same URL in your sitemap but in different language.

We will cover all of the above in this post because I am writing this while implementing Bard in one of my projects: MurterIN.

Installation

Run this from your project root in command line:

composer require laravelista/bard

It will get the latest stable release. Anything over 1.0.0 is good (~1.0).

Do not use dev-master. That is for development purposes only and can be unstable.

Laravel Boilerplate

In order to save you some time while dealing with sitemaps in Laravel, Bard comes with special abstract class that has out of the box methods for adding named routes to your sitemap. Also it comes with methods f