Released version 0.4.0

  • Fix compatibility with fof/pages. Requires the newly released version 0.4.0 of fof/pages to work
  • Fix compatibility with tags which were no longer listed in the sitemap since version 0.3.0
  • Cleaner discussions URLs when the slug is empty
  • Added /all to the sitemap when the discussion list isn't set as the index page

Update with

composer require fof/sitemap

And if you are using FoF Pages, you also need to do:

composer require fof/pages
    10 days later

    Found a bug with handling German Umlaute äöü. I have a user with one in their name, however the Flarum URL for the user swaps the umlaut to their non umlaut counterparts, which this extension doesn't recognize. This gave me a search console warning.

      Kakifrucht How did the user get one into their name? The validation logic for usernames only allows Latin characters and numbers and the underline.

        tankerkiller125 Interesting, the user was created back in the beginning of 2016, so that might be the reason. I will change the name manually then, thanks.

        10 days later

        Google Search Console is giving me "Sitemap could not be read, General HTTP error", upon reading the above posts I found that sitemap.xml is generate on fly, so I used php flarum fof:sitemap:cache --write-xml-file to generate the file and placed it in /public but still same error

          r4nchy what happens when you try accessing the sitemap via a browser? Are you able to share the link publicly?

          While not related to the error, if you decide to go with the "disk mode", don't forget to schedule the command so that the file gets updated.

            clarkwinkelmann When I tried to access the https://example.com/sitemap.xml via browser, it will open up the .xml file
            Yes the link can be accessed even without login

            I even tried moving it to /public/world/sitemap.xml and then point the Google Search Console to it, but same error

            Version 0.5.0 was released with support for customized named routes. This makes the extension compatible with Custom Paths. There are no other changes. There's no need to update immediately if you are already on 0.4.0 and don't need this compatibility.

            7 days later

            0.5.1

            • Use new Console extender
            • Add settings modal
            • Set default to runtime
            • For all modes other than runtime, the relevant command is registered with the scheduler
            • Provide selector from schedule run frequency - default daily
            • Requires flarum/core beta.13
            • Requires the Flarum Scheduler to be correctly configured

            image

            Updating

            composer require fof/sitemap
            php flarum migrate
            php flarum cache:clear

              IanM hi, i have cron available directly from the cpanel.
              My forum is small so I should be using runtime mode.
              How do you recommend setting up the cron? 1 time a day?
              If yes, what would be the command to send to add the cron process?
              Thanks so much.

              https://ibb.co/Fnty5Ts

              • IanM replied to this.

                excellent feature, 0.5.1 only runs one for every 24 hours to rebuild the sitemap ? 😄

                • IanM replied to this.

                  Gatsu more info on setting up cron with the Flarum scheduler here

                  In all cases, the cron should be the same, let Flarum decide on the schedule depending on your setting config

                    Hari depends on your choice of mode and frequency setting

                    4 days later

                    Hello,
                    I am trying to install this extension and I am getting the following error. I may have done something wrong. Thank you for your help.

                    composer require fof/sitemap
                    Using version ^0.5.1 for fof/sitemap
                    ./composer.json has been updated
                    Loading composer repositories with package information
                    Updating dependencies (including require-dev)
                    Your requirements could not be resolved to an installable set of packages.
                    
                      Problem 1
                        - fof/console 0.5.3 requires dragonmantank/cron-expression ^1.2.1 -> satisfiable by dragonmantank/cron-expression[v1.2.1] but these conflict with your requirements or minimum-stability.
                        - fof/sitemap 0.5.1 requires fof/console ^0.5.3 -> satisfiable by fof/console[0.5.3].
                        - Installation request for fof/sitemap ^0.5.1 -> satisfiable by fof/sitemap[0.5.1].
                    
                    
                    Installation failed, reverting ./composer.json to its original content.

                    Here is my php flarum info

                    php flarum info
                    Flarum core 0.1.0-beta.13
                    PHP version: 7.4.7
                    Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, pcntl, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, imagick, imap, intl, json, exif, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, soap, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlrpc, xmlwriter, xsl, zip, Zend OPcache
                    +-------------------------------+----------------+--------+
                    | Flarum Extensions             |                |        |
                    +-------------------------------+----------------+--------+
                    | ID                            | Version        | Commit |
                    +-------------------------------+----------------+--------+
                    | flarum-lang-english           | v0.1.0-beta.13 |        |
                    | flarum-tags                   | v0.1.0-beta.13 |        |
                    | flarum-approval               | v0.1.0-beta.13 |        |
                    | noriods-auto-more             | 0.3.0          |        |
                    | flarum-bbcode                 | v0.1.0-beta.12 |        |
                    | wiwatsrt-best-answer          | v0.2.4         |        |
                    | clarkwinkelmann-circle-groups | 0.2.1          |        |
                    | flarum-emoji                  | v0.1.0-beta.13 |        |
                    | clarkwinkelmann-emojionearea  | 0.2.2          |        |
                    | flarum-auth-facebook          | v0.1.0-beta.13 |        |
                    | squeevee-fancybox             | 0.2-beta       |        |
                    | flarum-flags                  | v0.1.0-beta.13 |        |
                    | fof-custom-footer             | 0.1.3          |        |
                    | fof-follow-tags               | 0.3.5          |        |
                    | fof-formatting                | 0.1.4          |        |
                    | fof-ignore-users              | 0.1.6          |        |
                    | fof-links                     | 0.2.1          |        |
                    | fof-merge-discussions         | 0.3.3          |        |
                    | fof-profile-image-crop        | 0.1.1          |        |
                    | fof-reactions                 | 0.2.5          |        |
                    | fof-share-social              | 0.1.2          |        |
                    | fof-socialprofile             | 0.1.2          |        |
                    | fof-spamblock                 | 0.2.2          |        |
                    | fof-split                     | 0.4.4          |        |
                    | fof-terms                     | 0.4.2          |        |
                    | fof-upload                    | 0.9.2          |        |
                    | fof-user-bio                  | 0.1.3          |        |
                    | fof-user-directory            | 0.3.4          |        |
                    | fof-recaptcha                 | 0.1.2          |        |
                    | flarum-likes                  | v0.1.0-beta.13 |        |
                    | flarum-lock                   | v0.1.0-beta.13 |        |
                    | flarum-markdown               | v0.1.0-beta.13 |        |
                    | flarum-mentions               | v0.1.0-beta.13 |        |
                    | antoinefr-online              | 0.4.0          |        |
                    | v17development-seo            | 1.2.1          |        |
                    | flarum-statistics             | v0.1.0-beta.13 |        |
                    | flarum-sticky                 | v0.1.0-beta.13 |        |
                    | flarum-subscriptions          | v0.1.0-beta.13 |        |
                    | jordanjay29-summaries         | 0.3.1          |        |
                    | flarum-suspend                | v0.1.0-beta.13 |        |
                    +-------------------------------+----------------+--------+
                    Base URL: https://whatsonyourscrubs.com
                    Debug mode: off

                    I hope this helps and thank you again.

                    Edit: It has been a few days and wondering if anyone else beside @ValiantShishu and I have had this issue and what you did to fix it. I know everyone is buys, I am hoping that someone will know how to fix it. Thank you.

                      ChadJessen composer require fof/sitemap
                      Using version 0.5.1 for fof/sitemap
                      ./composer.json has been updated
                      Loading composer repositories with package information
                      Updating dependencies (including require-dev)
                      Your requirements could not be resolved to an installable set of packages.

                      Problem 1
                      - fof/console 0.5.3 requires dragonmantank/cron-expression 1.2.1 -> satisfiable by dragonmantank/cron-expression[v1.2.1] but these conflict with your requirements or minimum-stability.
                      - fof/sitemap 0.5.1 requires fof/console 0.5.3 -> satisfiable by fof/console[0.5.3].
                      - Installation request for fof/sitemap 0.5.1 -> satisfiable by fof/sitemap[0.5.1].

                      Installation failed, reverting ./composer.json to its original content.

                      I have the same problem with him

                      a month later

                      I want to add events from my Calendar Events plugin. The code side makes sense. Assume that my extension will declare this as dependency -- but Is there a way to make the inclusion dynamic (if user has Fof/sitemaps)?

                      Also, I can see my Resource gets constructed during generation, but the query method never called.

                      https://github.com/eddiewebb/flarum-calendar/blob/seo/src/Integrations/SitemapsResource.php#L21

                      class SitemapsResource extends Resource
                      {
                      
                          public function __construct()
                          {
                              print('constructed');
                          }
                      
                          public function query(): Builder
                          {
                              print('queried');
                              return Model::query();
                          }
                      
                          public function url($model): string
                          {
                              print('ddd');
                              return $this->generateRouteUrl('advevent', [
                                  'id' => $model->id(),
                              ]);
                          }

                        eddiewebb I'm not sure about the query part. It's supposed to be called here. Maybe your print happens in a context where output is being buffered before rendering. Try throwing an exception instead. Also what happens if you don't try printing, any error?

                        Regarding dynamic inclusion, all you need to do is require fof/sitemap in your composer.json and call the extender, as you are already correctly doing. The call to the extender will always work whether or not fof/sitemap is actually enabled, but what the extender does will have no effect if the extension is disabled as fof.sitemap.resources will never be resolved.

                          Thanks clarkwinkelmann , if I remove print line it runs without error (but also without including the objects)

                          If I change to an exception it is never thrown. (where as constructor exception halts it)

                          class SitemapsResource extends Resource
                          {
                          
                              public function __construct()
                              {
                                  // exception or print will show if added here
                              }
                          
                              public function query(): Builder
                              {
                                  // print, throw do nothing here.
                                  throw new \Exception("Query was called");
                                  return Model::query();
                              }

                          SitemapGenerator is not resolving it after Register

                          I added a var_dump to your SitemapGenerator and only the 3 default resources are listed.

                          array(3) {
                            [0]=>
                            object(FoF\Sitemap\Resources\User)#748 (0) {
                            }
                            [1]=>
                            object(FoF\Sitemap\Resources\Discussion)#747 (0) {
                            }
                            [2]=>
                            object(FoF\Sitemap\Resources\Tag)#746 (0) {
                            }
                          }

                          HOWEVER - adding a var_dump to RegisterResource (line 44) correctly includes the core 3 + my extensions.

                          The list is not being correctly passed /persisted some reason. I even tried adding RequireResource directly to my site's extend.php, no change.

                          
                          array(4) {
                            [0]=>
                            object(FoF\Sitemap\Resources\User)#746 (0) {
                            }
                            [1]=>
                            object(FoF\Sitemap\Resources\Discussion)#745 (0) {
                            }
                            [2]=>
                            object(FoF\Sitemap\Resources\Tag)#744 (0) {
                            }
                            [3]=>
                            object(Webbinaro\AdvCalendar\Integrations\SitemapsResource)#736 (0) {
                            }
                          }