discourseEmbedUrl and Joomla


#1

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


(Vinoth Kannan) #2

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

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


#3

Thank you. Works as expected…!