No internet connection
  1. Home
  2. Issues

How to make Talkyard ignore URL parameters?

By Koos @koos
    2022-01-04 15:11:50.685Z

    Some of my visitors reach my posts through channels that add referer parameters to their links (f.e. '?ref=webdesignernews.com). Talkyard considers each set of parameters a different page, spreading the discussion out on several places (f.e. https://www.kooslooijesteijn.net/blog/web3 and https://www.kooslooijesteijn.net/blog/web3?ref=sidebar). Is there a setting to disable that behavior for my whole site?

    • 5 replies
    1. KajMagnus @KajMagnus2022-01-06 19:07:51.070Z2022-01-06 19:34:19.897Z

      Currently cannot be disabled, but I can fix that. What if you could set a config value:

      talkyardIgnoreQueryParams = true;    <—— this
      talkyardServerUrl = "https://....";
      talkyardScriptUrl = ...
      

      And then Talkyard would ignore the whole query string. (If, in some part of your website, you wanted Talkyard to do consider the query string, you could leave out that new conf val)

      I can do that now soon — there'll be a new release some time the next week.

      I'm thinking this might have been a good default. But I suspect it's too late, to make this the default, now.


      Sites that want to ignore all query params except for one, could do: (won't implement now, but later upon request)

      talkyardIgnoreQueryParams = true;
      talkyardConsiderQueryParams = ['blog-post-id'];
      

      And then /blog?blog-post-id=123 would be the same as /blog?blog-post-id=123&ref=sidebar&any=thing.


      Looking at your site, the /blog/web3 page, I see that quite a lot (I think) of comments have ended up on the wrong (I mean ref=sidebar) URL — that seems annoying (sorry). I'll write something tomorrow about how they can be moved, to the correct page.

      1. KKoos @koos
          2022-01-06 20:38:42.362Z

          Thanks!

          Currently cannot be disabled, but I can fix that. What if you could set a config value:

          That looks like a very reasonable solution to me!

          I'm thinking this might have been a good default. But I suspect it's too late, to make this the default, now.

          I'd think so, but maybe there's a quick way to cycle through all Talkyard-enabled pages and assess if any use URL parameters instead of pretty URLs? I expect that number to be low, as it's considered bad for SEO.

          A compromise would be to ignore only commonly used parameters by default, such as ref, campaign and UTM parameters.

          I see that quite a lot (I think) of comments have ended up on the wrong (I mean ref=sidebar) URL — that seems annoying (sorry).

          Don't worry about it, I don't care to much about this particular discussion. But it would be great to have it all in one place.

          1. a quick way to cycle through all Talkyard-enabled pages and assess if any use URL parameters instead of pretty URLs? I expect that number to be low

            You're right — I ran a SQL query, and it turns out that just 0.02% of the blogs at Ty .net, use a ?query=param to decide what page to show. And those blogs happen to be inactive anyway (aren't getting any comments).

            Whilst a hundred times more, have run into the problem with ?ref=... and ?utm...= ....

            So a better approach, is to start ignoring the query string by default, for everyone, and adding a config value for those few websites that do use a query param to decide what to show, and I'll email them about that.

        • In reply tokoos:

          Another thing you could do directly, is to specify a data-discussion-id="..." on new blogs. You could set it to a unique blog post ID, if there is any per blog post ID, in the blog platform you're using.

          Then the query string won't matter; instead, comments are looked up, by discussion id, on future blog posts. (So you can move pages to new URLs and the comments will move they too.)

          However, if you do this, with the already existing pages, I'd need to have a look at what'll happen then — if that might instead create a new discussion; then it'll look as if all old comments just disappeared.

          1. In reply tokoos:

            Hi Koos, this now fixed here at Ty .net (and in the self hosted release channel tomorrow I think):

            Now, by default, Talkyard ignores all query params.

            To make Talkyard consider one query param, one would do this:

            talkyardConsiderQueryParams = ['blog-post-id'];
            talkyardServerUrl = ...
            ...
            

            (Previously, Ty considered just one query param (because of a bug) — whichever happened to be first. Now Ty also looks at just one, and the array must be of size <= 1, otherwise, an error is logged.)

            (End-to-end test: https://github.com/debiki/talkyard/blob/35ec2078f1db48703eb0ab09fcac0077f4cc90f3/tests/e2e-wdio7/specs/embcom.ignore-query-params.2br.e2e.ts )

            (I tagged this topic with #docs-missing so hopefully i or someone will include this in the upcoming official docs somewhere.)

            1. Progress
              with handling this problem
            2. @KajMagnus marked this topic as Planned 2022-01-06 19:08:15.338Z.
            3. @KajMagnus marked this topic as Started 2022-01-07 10:27:47.061Z.