discourseEmbedUrl and Joomla

I have successfully used embedding to link my joomla website with discourse. Well, sort of successfully! It works well however I have an issue with discourseEmbedUrl. At the moment I’m using:

discourseEmbedUrl: window.location.href };

Which works great for the most part:wink: However, this solution also creates new topics for URLs which include URL Query String Parameters. So for example this creates two new discourse topics for a single article URL:

https://example.com/artcile1
and
https://example.com/artcile1?somequerystring

I can clean the Query String Parameters for each URL using nginx redirection however this breaks the website’s search etc.

I’m not very proficient in javascript nor PHP but I’m sure that there must be a better solution to this issue. Any suggestion on how to better define my discourseEmbedUrl with Joomla CMS?

Any help is much appreciated… Thank you

You can use the below code. It will remove the query string from URL.

discourseEmbedUrl: window.location.href.split(/[?#]/)[0] };

5 Likes

Thank you. Works as expected…!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.