pecotamic / sitemap

Sitemap for Statamic v3
6 stars 9 forks source link

Feature: ability to add extra entries programmatically #19

Closed pohnean closed 2 years ago

pohnean commented 2 years ago

This PR adds the ability to register new SitemapEntries programmatically.

This is useful when you have custom routes / controllers defined i.e. Route::statamic('blog/authors/{slug}', 'authors.show');

The usage is similar to adding routes dynamically in Statamic's SSG add-on (https://github.com/statamic/ssg)

Here is an example of how to use it:

In AppServiceProvider.php

image
werner-freytag commented 2 years ago

Thank you for your feature request and your submission.

However I would like to change your code a little bit:

  1. The code ($extraEntries) should not be static
  2. I prefer to avoid if wherever possible, so the $extraEntries should always be initialized
werner-freytag commented 2 years ago

Your code has been added in release 1.4.0