• Support
  • Allow additional url parameters

The issue

I have the requirement to allow additional URL parameters, for example:https://mydomain.xy/d/123-topic?lang=de-DE

But the additional parameters are automatically removed. This works on overview pages, but not in the thread view.

Is it possible, to keep this parameters?

Flarum information

Flarum core: 1.8.9
PHP version: 8.3.15
MySQL version: 8.0.25-15
Loaded extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, hash, iconv, json, mbstring, SPL, session, PDO, pdo_sqlite, bz2, posix, random, readline, Reflection, standard, SimpleXML, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, imagick, bcmath, Phar, calendar, exif, ftp, gettext, gmp, gd, imap, intl, ldap, mysqli, pcntl, pdo_dblib, pdo_mysql, pdo_pgsql, pgsql, pspell, shmop, soap, sockets, sodium, sysvmsg, sysvsem, sysvshm, tidy, xsl, yaml, zip
+----------------------------------+---------+--------+
| Flarum Extensions                |         |        |
+----------------------------------+---------+--------+
| ID                               | Version | Commit |
+----------------------------------+---------+--------+
| flarum-flags                     | v1.8.2  |        |
| flarum-tags                      | v1.8.3  |        |
| flarum-approval                  | v1.8.2  |        |
| fof-pages                        | 1.0.8   |        |
| flarum-suspend                   | v1.8.4  |        |
| flarum-mentions                  | v1.8.5  |        |
| flarum-subscriptions             | v1.8.1  |        |
| fof-sitemap                      | 2.2.1   |        |
| afrux-forum-widgets-core         | v0.1.7  |        |
| fof-user-directory               | 1.3.3   |        |
| fof-follow-tags                  | 1.2.7   |        |
| webbinaro-calendar               | 1.7.0   |        |
| v17development-seo               | v2.0.5  |        |
| tohsakarat-table-of-content      | v1.1.1  |        |
| the-turk-flamoji                 | 1.0.4   |        |
| nearata-copy-code-to-clipboard   | v2.2.0  |        |
| kyrne-whisper                    | 0.1.4   |        |
| katosdev-signature               | 1.6     |        |
| justoverclock-users-map-location | 0.1.6   |        |
| justoverclock-custom-html-widget | 0.1.4   |        |
| ianm-html-head                   | 1.2.4   |        |
| gtdxyz-badges                    | 1.0.1   |        |
| glutio-email-links               | 0.0.1   |        |
| fof-user-bio                     | 1.4.2   |        |
| fof-upload                       | 1.7.1   |        |
| fof-terms                        | 1.4.2   |        |
| fof-split                        | 1.1.1   |        |
| fof-socialprofile                | 1.1.6   |        |
| fof-polls                        | 2.2.12  |        |
| fof-nightmode                    | 1.6.0   |        |
| fof-links                        | 1.3.0   |        |
| fof-impersonate                  | 1.2.0   |        |
| fof-gamification                 | 1.6.8   |        |
| fof-forum-statistics-widget      | 1.2.1   |        |
| fof-default-user-preferences     | 1.2.1   |        |
| fof-best-answer                  | 1.6.3   |        |
| fof-anti-spam                    | 1.1.3   |        |
| fof-analytics                    | 1.1.0   |        |
| flarum-sticky                    | v1.8.2  |        |
| flarum-statistics                | v1.8.1  |        |
| flarum-pusher                    | v1.8.1  |        |
| flarum-nicknames                 | v1.8.2  |        |
| flarum-markdown                  | v1.8.1  |        |
| flarum-lock                      | v1.8.2  |        |
| flarum-lang-german               | 1.17.0  |        |
| flarum-lang-english              | v1.8.0  |        |
| flarum-bbcode                    | v1.8.0  |        |
| davwheat-custom-sidenav-links    | 1.0.1   |        |
| datlechin-link-preview           | v1.6.0  |        |
| darkle-fancybox                  | 2.1.0   |        |
| clarkwinkelmann-mailing          | 1.1.0   |        |
| askvortsov-pwa                   | v3.4.0  |        |
| archlinux-de-discussion-feed     | 1.0.2   |        |
| afrux-online-users-widget        | v0.1.9  |        |
+----------------------------------+---------+--------+
Base URL: https://forum.t3academy.de
Installation path: /html/forum.t3academy.de
Queue driver: sync
Session driver: file
Scheduler status: Aktiv
Mail driver: smtp
Debug mode: off

I don't have the time to look into the code right now to link to the correct place, but the reason query parameters disappear from the discussion page is because of the logic that updates the URL as you scroll down the discussion. An extension that adds additional parameters needs to capture the value at page load, and then hook into the URL update logic to re-add the query string every time the URL changes (if it still needs to be there).

Thanks for the answer. This is probably controlled in the flarum.js file.